-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Latest changes at the end of cycle 19-1
- Loading branch information
Showing
2 changed files
with
42 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import logging | ||
import logging.handlers | ||
|
||
|
||
def get_logger(): | ||
# Setup beamline specifics: | ||
beamline_gpfs_path = '/nsls2/xf07bm' | ||
|
||
logger = logging.getLogger('xas_logger') | ||
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s') | ||
|
||
# only add handlers if not added before | ||
if not len(logger.handlers): | ||
logger.setLevel(logging.DEBUG) | ||
# Write DEBUG and INFO messages to /var/log/data_processing_worker/debug.log. | ||
debug_file = logging.handlers.RotatingFileHandler( | ||
beamline_gpfs_path + '/log/data_processing_debug.log', | ||
maxBytes=10000000, backupCount=9) | ||
debug_file.setLevel(logging.DEBUG) | ||
debug_file.setFormatter(formatter) | ||
logger.addHandler(debug_file) | ||
|
||
# Write INFO messages to /var/log/data_processing_worker/info.log. | ||
info_file = logging.handlers.RotatingFileHandler( | ||
beamline_gpfs_path + '/log/data_processing.log', | ||
maxBytes=10000000, backupCount=9) | ||
info_file.setLevel(logging.INFO) | ||
info_file.setFormatter(formatter) | ||
logger.addHandler(info_file) | ||
|
||
|
||
return logger |