@Name : __setLogHandler @Desc: Adds the given Log handler to the current logger @Input: log_file_path: Log File Path as where to store the logs log_format : Format of log messages to be dumped log_level : Determines the level of logging for this
(self, log_file_path,
log_format=None,
log_level=logging.DEBUG)
| 68 | self.__logger.setLevel(logging.DEBUG) |
| 69 | |
| 70 | def __setLogHandler(self, log_file_path, |
| 71 | log_format=None, |
| 72 | log_level=logging.DEBUG): |
| 73 | ''' |
| 74 | @Name : __setLogHandler |
| 75 | @Desc: Adds the given Log handler to the current logger |
| 76 | @Input: log_file_path: Log File Path as where to store the logs |
| 77 | log_format : Format of log messages to be dumped |
| 78 | log_level : Determines the level of logging for this logger |
| 79 | @Output: SUCCESS if no issues else FAILED |
| 80 | ''' |
| 81 | try: |
| 82 | if log_file_path is not None: |
| 83 | stream = logging.FileHandler(log_file_path) |
| 84 | else: |
| 85 | stream = logging.StreamHandler(stream=sys.stdout) |
| 86 | |
| 87 | if log_format is not None: |
| 88 | stream.setFormatter(log_format) |
| 89 | else: |
| 90 | stream.setFormatter(self.__class__.logFormat) |
| 91 | stream.setLevel(log_level) |
| 92 | self.__logger.addHandler(stream) |
| 93 | return SUCCESS |
| 94 | except Exception as e: |
| 95 | print("\nException Occurred Under " \ |
| 96 | "__setLogHandler %s" % GetDetailExceptionInfo(e)) |
| 97 | return FAILED |
| 98 | |
| 99 | def __cleanPreviousLogs(self, logfolder_to_remove): |
| 100 | ''' |
no test coverage detected