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

Add logger details - Filename, Line number, Method name to aid in debugging #73

Open
leet86 opened this issue Sep 15, 2022 · 0 comments

Comments

@leet86
Copy link
Contributor

leet86 commented Sep 15, 2022

Proposed improvements to logging (see example log output below)

Include Timestamp, Filename, Line number, Method in the log output

  • use the logging.Formatter
FORMAT = "[%(asctime)s %(filename)s:%(lineno)s - %(funcName)s()]- %(message)s"
fh.setFormatter(logging.Formatter(FORMAT))
self.logger.addHandler(fh)
[2022-09-14 22:22:20,629 Recordurbate.py:48 - run()]- calling Recordurbate.start()
[2022-09-14 22:22:20,629 Recordurbate.py:118 - bot()]- starting daemon
[2022-09-14 22:22:20,629 Recordurbate.py:121 - bot()]- daemon created
[2022-09-14 22:22:20,630 daemon.py:26 - daemonize()]- Starting daemon
[2022-09-14 22:22:20,630 daemon.py:26 - daemonize()]- calling os.fork()
[2022-09-14 22:22:20,630 daemon.py:26 - daemonize()]- Initial PID = 22159
[2022-09-14 22:22:20,631 daemon.py:26 - daemonize()]- Fork PID = 22160
[2022-09-14 22:22:20,631 daemon.py:26 - daemonize()]- Double Fork PID = 22161 - fully daemonized
[2022-09-14 22:22:20,633 daemon.py:26 - daemonize()]- Started daemon, pid: 22161
[2022-09-14 22:22:21,633 bot.py:22 - reload_streamers_json()]- Loading Initial streamers_json
[2022-09-14 22:22:22,633 Recordurbate.py:56 - run()]- calling Recordurbate.add()
[2022-09-14 22:22:23,633 bot.py:196 - run()]- Started _streamerName_ 
[2022-09-14 22:22:24,633 bot.py:168 - run()]- Stream Ended _streamerName_ 15m 5s
[2022-09-14 22:22:23,633 bot.py:196 - run()]- Started _streamerName_ 
[2022-09-14 22:22:27,402 Recordurbate.py:48 - run()]- calling Recordurbate.stop()
[2022-09-14 22:22:27,403 Recordurbate.py:118 - bot()]- starting daemon
[2022-09-14 22:22:27,403 Recordurbate.py:121 - bot()]- daemon created
[2022-09-14 22:24:27,404 bot.py:22 - stop()]- Caught stop signal, stopping
[2022-09-14 22:24:27,405 bot.py:22 - log_current_streams()]- Current Recordings: 0
[2022-09-14 22:24:27,406 bot.py:249 - log_current_streams()]-     _streamerName_  2m 5s
[2022-09-14 22:24:27,407 Recordurbate.py:130 - bot()]- daemon stopped
[2022-09-14 22:22:27,650 bot.py:22 - run()]- Bot stopped
@leet86 leet86 changed the title Add logger details - Timestamp, Filename, Line number, Method to aid in debugging Add logger details - Filename, Line number, Method name to aid in debugging Sep 15, 2022
leet86 added a commit to leet86/Recordurbate that referenced this issue Sep 15, 2022
…me to logger format

Added Filename, Line number, and Method name to logger format
oliverjrose99 added a commit that referenced this issue Sep 16, 2022
…ename,-Line-number,-Method-name-to-aid-in-debugging

Fixes Issue #73 Add Filename, Line number, and Method name to logger …
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

No branches or pull requests

1 participant