anvilistas / anvil-extras

Other
76 stars 21 forks source link

error while trying to use Logger #502

Closed GDuroS closed 3 months ago

GDuroS commented 3 months ago

Describe the bug While creating a logger instance and using it, the following error occours

ExternalError: TypeError: Cannot read properties of undefined (reading 'ob$type')
at app/anvil_extras/logging.py, line 81
called from app/anvil_extras/logging.py, line 90
called from Core.Main, line 31
called from Core.Main, line 150

The code running the error is as follows

from anvil_extras import logging
logger = logging.Logger(name="LOGGER", level=logging.INFO, format="{date:%Y-%m-%d %H:%M:%S} | {level} - {name} => {msg}")
logger.info("Olá")

This happens in every app that I tested.

Version Using the published version of anvil-extras

s-cork commented 3 months ago

this is partly a bug in skulpt that error should be better

in the logging mechanism you have datetime and replacing date with datetime will work for you

It looks like I missed date from the actually options despite documenting it

s-cork commented 3 months ago

fwiw - added a PR to skulpt that would have given a proper error message: https://github.com/skulpt/skulpt/pull/1539

GDuroS commented 3 months ago

Of course... my bad, I didn't realized that I was using date instead of datetime. I was gonna use date and then time in the format, but realized that was silly since I coud just use datetime, but forgot to change it. Sorry for the trouble, thanks for the hard work!