Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log handeling #3

Closed
brenttaylor opened this issue Feb 26, 2016 · 8 comments
Closed

Log handeling #3

brenttaylor opened this issue Feb 26, 2016 · 8 comments

Comments

@brenttaylor
Copy link
Contributor

Is there a reason you're using your own logging functionality over the python supplied "logging" module? Should cut down your code significantly and it's more fault tolerant and less error prone.

I'd be happy to change it over. :)

@brenttaylor brenttaylor mentioned this issue Feb 26, 2016
Closed
@ironman5366
Copy link
Owner

Mainly just because I REALLY like the look and style of my terminal logging. I'm fairly ignorant of the python builtin logging (having always used my own), could it be formatted with utilities like termcolor like mine is? And I also have two settings in mine that determine whether you want to keep logs or delete the old ones and whether you want to see terminal output or just a log file written. If this stuff can be replicated the sure, go for it.

@brenttaylor
Copy link
Contributor Author

Everything but the color can be replicated. That said, the built in logging is a lot more robust and fault tolerant and we should really be using it. Generally speaking, if it's in the standard library you want to use it rather than rolling your own unless you have a very good reason to do otherwise.

I'll get started refactoring the logging code today.

@ironman5366
Copy link
Owner

Yeah sure I guess. I am pretty partial to my terminal logging though, it's been a part of W.I.L.L for awhile. If you wouldn't mind going out of your way, can you get the log entry from the good builtin logging module and pass it through with termcolor like I've been doing?

@brenttaylor
Copy link
Contributor Author

I'll look into it. That said, I'm personally partial to removing termcolor all together. It doesn't play well with everything, especially on windows. It's all sorts of odd in PowerShell, for example.

@ironman5366
Copy link
Owner

Fair enough. I appreciate you working on it, thanks.

@ironman5366
Copy link
Owner

Ok. So I merged in the code and I can't seem to fix the following error:
Traceback (most recent call last): File "main.py", line 15, in <module> from logger import log File "/home/will/Code/W.I.L.L/logger.py", line 88, in <module> _setup_logger() File "/home/will/Code/W.I.L.L/logger.py", line 45, in _setup_logger log.setLevel(_get_logging_level()) File "/home/will/Code/W.I.L.L/logger.py", line 63, in _get_logging_level return logging.DEBUG if will_config["debug"] else logging.ERROR KeyError: 'debug'
I looked through the code and I'm not completely sure what's happening here. My config.json is set up

@ironman5366
Copy link
Owner

My mistake, I hadn't made the necessary changes to config.json. Closing

@brenttaylor
Copy link
Contributor Author

That really should be considered a bug. I'll write up a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants