pyfan.devel.flog.logsupport
¶
The pyfan.devel.flog.logsupport
initiates logging and set logging options, output log path
points.
This is imported into other programs as import pyfan.devel.flog.logsupport as pyfan_logsup
Includes method log_vig_start()
, log_format()
Module Contents¶
Functions¶
|
Start logging to log file |
|
Logging formats |
-
pyfan.devel.flog.logsupport.
log_vig_start
(spt_root, main_folder_name, file_name='fs_gen_combo_type', sub_folder_name=None, subsub_folder_name=None, it_time_format=8, log_level=logging.WARNING, **kwargs)[source]¶ Start logging to log file
Generate path to log file and initiate log file. Return this full path to log file. Configure the log file with formating
- Parameters
- spt_rootstr
folder root to log file.
- main_folder_namestr
main folder, appended to spt_root.
- file_namestr
file name for the log file, without suffix.
- sub_folder_namestr, optional
possible subfolder name. This is double pound vig level.
- subsub_folder_namestr, optional
possible subsub folder name. try not to have lower than this level. This is triple pound vig level.
- it_time_formatint
different types of time formatting, if it_time_format is zero, no time suffix
- log_levelint
logging level integers to report, including CRITICAL 50 ERROR 40 WARNING 30 INFO 20 DEBUG 10 NOTSET 0.
- **kwargs
Arguments for functions that is called, including
log_format()
- Returns
- str
return the path to the log file
Examples
>>> log_vig_start(spt_root = 'C:/Users/fan/', ... main_folder_name='logvig', sub_folder_name='parameters', ... subsub_folder_name='combo_type', ... file_name='fs_gen_combo_type', ... it_time_format=8, log_level=logging.INFO) C:\Users\fan\logvig\parameters\combo_type\fs_gen_combo_type_20201030.log.py
-
pyfan.devel.flog.logsupport.
log_format
(bl_set_print_opt=True, it_print_opt=1)[source]¶ Logging formats
This is called by
log_vig_start()
, with parameters fed in with kwargs- Parameters
- bl_set_print_optbool, optional
If to set numpy table printing options, how many columns and decimal controls
- it_print_optint, optional
Different possible options to set
- Returns
- str
formatting string options for logging config
Examples
>>> log_format(bl_set_print_opt = True, it_print_opt = 1) '%(filename)s - %(funcName)s - %(lineno)d - %(asctime)s - %(levelname)s %(message)s'