| DayF core 1.2.1.2 DayF (Decision at your Fingertips) is an AutoML freeware development framework that let developers works with Machine Learning models without any idea of AI, simply taking a csv dataset and the objective column

logshandler.py
1
5
6 '''
7 Copyright (C) e2its - All Rights Reserved
8 * Unauthorized copying of this file, via any medium is strictly prohibited
9 * Proprietary and confidential
10 *
11 * This file is part of gDayF project.
12 *
13 * Written by Jose L. Sanchez <e2its.es@gmail.com>, 2016-2019
14 '''
15
16 import logging
17 import logging.config
18 from gdayf.conf.loadconfig import LoadConfig
19
20
23 class LogsHandler (object):
24
25 def __init__(self, e_c, module=__name__):
26 # @var _config
27 # protected variable for loading and store DayF whole configuration parameters
28 self._ec = e_c
29 self._conf = self._ec.config.get_config()['logging']
30 # @var logger
31 # variable for setting log global handlers
32 self.logger = logging.getLogger(module)
33 self.logger.setLevel('DEBUG')
34 logging.config.dictConfig(dict(self._conf))
35
36
41 @staticmethod
42 def _compose_log_record(trigger, session, message, add_message=''):
43 record = list()
44 record.append('\t')
45 record.append(trigger)
46 record.append('\t')
47 record.append(session)
48 record.append('\t')
49 record.append(message)
50 record.append('\t')
51 record.append(str(add_message))
52 return ''.join(record)
53
54
60 def log_info(self, trigger, session, message, add_message=''):
61 print(self._compose_log_record(trigger, session, message, add_message))
62 self.logger.info(self._compose_log_record(trigger, session, message, add_message))
63
64
70 def log_critical(self, trigger, session, message, add_message=''):
71 print(self._compose_log_record(trigger, session, message, add_message))
72 self.logger.critical(self._compose_log_record(trigger, session, message, add_message))
73
74
80 def log_exec(self, trigger, session, message, add_message=''):
81 self.logger.info(self._compose_log_record(trigger, session, message, add_message))
82
83
89 def log_warning(self, trigger, session, message, add_message=''):
90 self.logger.warning(self._compose_log_record(trigger, session, message, add_message))
91
92
98 def log_error(self, trigger, session, message, add_message=''):
99 self.logger.error(self._compose_log_record(trigger, session, message))
100
101
107 def log_debug(self, trigger, session, message, add_message=''):
108 self.logger.debug(self._compose_log_record(trigger, session, message, add_message))
gdayf.logs.logshandler.LogsHandler.log_exec
def log_exec(self, trigger, session, message, add_message='')
Method for EXECUTION (INFO EQUIVALENT) events.
Definition: logshandler.py:80
gdayf.logs.logshandler.LogsHandler
Class oriented to manage all messages and interaction with DayF product logs.
Definition: logshandler.py:23
gdayf.logs.logshandler.LogsHandler.__init__
def __init__(self, e_c, module=__name__)
Constructor.
Definition: logshandler.py:25
gdayf.logs.logshandler.LogsHandler.log_info
def log_info(self, trigger, session, message, add_message='')
Method for INFO events.
Definition: logshandler.py:60
gdayf.logs.logshandler.LogsHandler.log_critical
def log_critical(self, trigger, session, message, add_message='')
Method for CRITICAL events.
Definition: logshandler.py:70
gdayf.logs.logshandler.LogsHandler._ec
_ec
Definition: logshandler.py:28
gdayf.logs.logshandler.LogsHandler._conf
_conf
Definition: logshandler.py:29
gdayf.logs.logshandler.LogsHandler._compose_log_record
def _compose_log_record(trigger, session, message, add_message='')
Static protected method for composing messages.
Definition: logshandler.py:42
gdayf.logs.logshandler.LogsHandler.log_warning
def log_warning(self, trigger, session, message, add_message='')
Method for WARNING events.
Definition: logshandler.py:89
gdayf.logs.logshandler.LogsHandler.logger
logger
Definition: logshandler.py:32
gdayf.logs.logshandler.LogsHandler.log_debug
def log_debug(self, trigger, session, message, add_message='')
Method for DEBUG events.
Definition: logshandler.py:107
gdayf.conf.loadconfig
Define all objects, functions and structs related to load on system all configuration parameter from ...
Definition: loadconfig.py:1
gdayf.logs.logshandler.LogsHandler.log_error
def log_error(self, trigger, session, message, add_message='')
Method for ERROR) events.
Definition: logshandler.py:98