Skip to content

Remove some side effects and add an optional to save log to file as well. #1

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

shawnLeeZX
Copy link

Hi benley:

I found your code while trying to find a more permanent solution to logging. Nice work!

Just fix something and add something to make it better.

  • While I was trying to get it to use, I found all logs are printed
    twice. After some debugging, I found this was due to the root logger gets two
    handlers since you add one more glog-style formatter handler. So if there are
    other libraries also add some handler to the root logger, which is my case,
    the log will be printed multiple times. To fix this, I use a standalone
    handler and set logger.propagate = False. So the side effects are
    removed.
  • I also add some configuration to let people choose to save their log. The
    usage is updated in the README.
  • The last commit is due to I am not sure what is the use of glog.INFO etc. Revert to the old code by this commit.

Shawn
Best

standalone logger.
Bug fixs. INFO, WARNING etc now works.
Now log could be configured to be written to file as well.
@benley benley self-assigned this Nov 20, 2015
  INFO level logging is used and is expected in stdout.
* Program now could handle file object output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants