Changeset 38beeab in sasview for run.py


Ignore:
Timestamp:
Apr 9, 2017 3:45:49 AM (20 months ago)
Author:
Ricardo Ferraz Leal <ricleal@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_Invariant, ESS_GUI_Pr_fixes, ESS_GUI_batch_fitting, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_ordering, SVCC-1, SasView-664, config-error, costrafo411, py37-all, py37-sascalc, py37-sasgui, pytest, setup_clean_up, simplify-c-build, ticket-1094-headless, ticket-1111, ticket-1205-fit-weights, ticket-1218, ticket-1220, ticket-818, ticket885, unittest-saveload, win64bit_conda_vm
Children:
797a2e8
Parents:
5af6f58
Message:

Logger is now a separate file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • run.py

    r64ca561 r38beeab  
    1414""" 
    1515 
    16 import os 
    17 import sys 
    1816import imp 
    1917import logging 
    2018import logging.config 
     19import os 
     20import sys 
     21from contextlib import contextmanager 
     22from os.path import join as joinpath 
     23from os.path import abspath, dirname 
    2124 
    22 from contextlib import contextmanager 
    23 from os.path import abspath, dirname, join as joinpath 
     25from sasview.logger_config import SetupLogger 
    2426 
     27l = SetupLogger(__name__) 
     28logger = l.config_development() 
    2529 
    26 LOGGER_CONFIG_FILE = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'sasview/logging.ini') 
    27 logging.config.fileConfig(LOGGER_CONFIG_FILE, disable_existing_loggers=True) 
    28 logger = logging.getLogger(__name__) 
    29  
    30 def update_all_logs_to_debug(logger): 
    31     ''' 
    32     This updates all loggers and respective handlers to DEBUG 
    33     ''' 
    34     for handler in logger.handlers or logger.parent.handlers: 
    35         handler.setLevel(logging.DEBUG) 
    36     for name,_ in logging.Logger.manager.loggerDict.items(): 
    37         logging.getLogger(name).setLevel(logging.DEBUG) 
    38          
    3930def addpath(path): 
    4031    """ 
     
    154145 
    155146if __name__ == "__main__": 
    156     update_all_logs_to_debug(logger) 
     147    logger.debug("Starting SASVIEW in debug mode.") 
    157148    prepare() 
    158149    from sas.sasview.sasview import run 
    159150    run() 
    160      
     151    logger.debug("Ending SASVIEW in debug mode.") 
Note: See TracChangeset for help on using the changeset viewer.