fixing issues with log file on readthedocs
This commit is contained in:
parent
4dea07b1d1
commit
2a84ee47e8
@ -41,22 +41,31 @@ except ImportError:
|
|||||||
stream_handler = logging.StreamHandler()
|
stream_handler = logging.StreamHandler()
|
||||||
stream_handler.setLevel(logging.ERROR)
|
stream_handler.setLevel(logging.ERROR)
|
||||||
|
|
||||||
# Save all logs to a file, which contains more detailed output
|
on_rtd = os.environ.get('READTHEDOCS') == 'True'
|
||||||
logging.basicConfig(
|
if on_rtd:
|
||||||
level = logging.INFO,
|
logging.basicConfig(
|
||||||
format='%(asctime)s | %(name)s | %(levelname)s: %(message)s',
|
level = logging.INFO,
|
||||||
datefmt='%d-%m-%Y %H:%M:%S',
|
format='%(asctime)s | %(name)s | %(levelname)s: %(message)s',
|
||||||
handlers=[
|
datefmt='%d-%m-%Y %H:%M:%S',
|
||||||
|
handlers=[stream_handler])
|
||||||
|
|
||||||
|
else:
|
||||||
|
# Save all logs to a file, which contains more detailed output
|
||||||
|
logging.basicConfig(
|
||||||
|
level = logging.INFO,
|
||||||
|
format='%(asctime)s | %(name)s | %(levelname)s: %(message)s',
|
||||||
|
datefmt='%d-%m-%Y %H:%M:%S',
|
||||||
|
handlers=[
|
||||||
|
|
||||||
stream_handler, # add stream handler from above
|
stream_handler, # add stream handler from above
|
||||||
|
|
||||||
RotatingFileHandler( # log to a file too
|
RotatingFileHandler( # log to a file too
|
||||||
f'{top_level}/logs/inkycal.log', # file to log
|
f'{top_level}/logs/inkycal.log', # file to log
|
||||||
maxBytes=2097152, # 2MB max filesize
|
maxBytes=2097152, # 2MB max filesize
|
||||||
backupCount=5 # create max 5 log files
|
backupCount=5 # create max 5 log files
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
# Show less logging for PIL module
|
# Show less logging for PIL module
|
||||||
logging.getLogger("PIL").setLevel(logging.WARNING)
|
logging.getLogger("PIL").setLevel(logging.WARNING)
|
||||||
|
Loading…
Reference in New Issue
Block a user