Changeset 799963c in sasview for src


Ignore:
Timestamp:
Aug 13, 2018 11:13:27 AM (6 years ago)
Author:
Torin Cooper-Bennun <torin.cooper-bennun@…>
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
328f2ef
Parents:
ecfe6b6
git-author:
Torin Cooper-Bennun <torin.cooper-bennun@…> (08/13/18 11:12:53)
git-committer:
Torin Cooper-Bennun <torin.cooper-bennun@…> (08/13/18 11:13:27)
Message:

add user config flag for disabling DEBUG logs

Location:
src/sas
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sas/logger_config.py

    re4335ae r799963c  
    77 
    88import pkg_resources 
     9 
     10from sas import get_custom_config 
    911 
    1012''' 
     
    3941        logging.captureWarnings(True) 
    4042 
     43        self._disable_debug_from_config() 
     44 
    4145        return logger 
     46 
     47    def _disable_debug_from_config(self): 
     48        '''disable DEBUG logs as per user configuration (DEBUG logs disabled by default)''' 
     49        disable_debug = True 
     50        custom_config = get_custom_config() 
     51 
     52        if hasattr(custom_config, "FILTER_DEBUG_LOGS"): 
     53            if type(custom_config.FILTER_DEBUG_LOGS) is bool: 
     54                disable_debug = custom_config.FILTER_DEBUG_LOGS 
     55            else: 
     56                logging.warning("FILTER_DEBUG_LOGS has invalid value in custom_config.py") 
     57 
     58        if disable_debug: 
     59            # logging.info("Note: DEBUG logs are disabled.") 
     60            logging.disable(logging.DEBUG) 
    4261 
    4362    def _read_config_file(self): 
  • src/sas/sasview/custom_config.py

    r914ba0a r799963c  
    1616DEFAULT_PERSPECTIVE = "Fitting" 
    1717SAS_OPENCL = "None" 
     18 
     19# Logging options 
     20FILTER_DEBUG_LOGS = True 
Note: See TracChangeset for help on using the changeset viewer.