From fba81ef345cdfd2efac2a9304d22823ba2f9fb9a Mon Sep 17 00:00:00 2001 From: KenwoodFox Date: Sat, 27 Nov 2021 16:03:20 -0500 Subject: [PATCH] Add ability to log remote --- companion_software/dashboard/dash.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/companion_software/dashboard/dash.py b/companion_software/dashboard/dash.py index d7c8c17..cdd2af1 100644 --- a/companion_software/dashboard/dash.py +++ b/companion_software/dashboard/dash.py @@ -6,7 +6,8 @@ import coloredlogs verboselogs.install() # Create a logger object. -logger = logging.getLogger(__name__) +hlog = logging.getLogger('Houston_Log') +rlog = logging.getLogger('Robot_Log') # By default the install() function installs a handler on the root logger, # this means that log messages from your code and log messages from the @@ -17,15 +18,22 @@ logger = logging.getLogger(__name__) # If you don't want to see log messages from libraries, you can pass a # specific logger object to the install() function. In this case only log # messages originating from that logger will show up on the terminal. -coloredlogs.install(level='INFO', logger=logger) +coloredlogs.install(level='INFO', + logger=hlog, + fmt='%(asctime)s,%(msecs)03d %(hostname)s %(levelname)s %(message)s') -logger.info('Lewis Companion Software Started.') -logger.success('Ready to robot!') +coloredlogs.install(level='INFO', + logger=rlog, + fmt='%(asctime)s,%(msecs)03d Robot %(levelname)s %(message)s') + +hlog.info('Lewis Companion Software Started.') +hlog.success('Ready to robot!') +rlog.info('Logging message from robot!') # Junk~ while True: try: - logger.debug('Nothing to do.') + hlog.debug('Nothing to do.') time.sleep(1) except KeyboardInterrupt: break