Skip to content

Commit

Permalink
rollover logging
Browse files Browse the repository at this point in the history
  • Loading branch information
gdecker1 committed Jun 24, 2023
1 parent 3789b47 commit 52e8fdd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lumaviewpro.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
Gerard Decker, The Earthineering Company
MODIFIED:
June 1, 2023
June 24, 2023
'''

# General
Expand Down Expand Up @@ -2810,10 +2810,11 @@ def on_start(self):
# Clock.schedule_once(lumaview.ids['motionsettings_id'].ids['protocol_settings_id'].ids['stage_widget_id'].draw_labware, 5)

def build(self):
current_time = time.strftime("%m/%d/%Y", time.localtime())
logger.info('[LVP Main ] LumaViewProApp.build()')

logger.info('[LVP Main ] -----------------------------------------')
logger.info('[LVP Main ] Code Compiled On: 4/20/2023')
logger.info('[LVP Main ] Code Compiled On: %s', current_time)
logger.info('[LVP Main ] Run Time: ' + time.strftime("%Y %m %d %H:%M:%S"))
logger.info('[LVP Main ] -----------------------------------------')

Expand Down
7 changes: 5 additions & 2 deletions lvp_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@
Gerard Decker, The Earthineering Company
MODIFIED:
May 31, 2023
June 24, 2023
'''

'''
lvp_logger.py configures a standard python logger for LumaViewPro.
'''

import logging
from logging.handlers import RotatingFileHandler
import os
if not os.path.exists("logs/LVP_Log"):
os.makedirs("logs/LVP_Log")
Expand Down Expand Up @@ -67,6 +68,8 @@ def format(self, record):

# obtains name of the module (file) importing lvp_logger
filename = '%s' % __file__
file_handler = logging.FileHandler(LOG_FILE)
file_handler = RotatingFileHandler(LOG_FILE, mode='a', maxBytes=1*1024*1024,
backupCount=0, encoding=None, delay=False)
# file_handler = logging.FileHandler(LOG_FILE)
file_handler.setFormatter(CustomFormatter())
logger.addHandler(file_handler)

0 comments on commit 52e8fdd

Please sign in to comment.