1
0
mirror of https://github.com/avatao-content/test-tutorial-framework synced 2024-12-05 02:11:32 +00:00

Refactor TFW logging

This commit is contained in:
R. Richard 2019-06-28 17:36:03 +02:00
parent b392749643
commit 8590aba8dd
2 changed files with 14 additions and 5 deletions

View File

@ -1,4 +1,5 @@
import logging
from sys import stderr
from ast import literal_eval
from functools import partial
from signal import signal, SIGTERM, SIGINT
@ -12,8 +13,8 @@ from tfw.builtins import LogMonitoringEventHandler, ProcessManagingEventHandler
from tfw.builtins import DirectorySnapshottingEventHandler, FSMManagingEventHandler, MessageSender
from tfw.components import TerminalCommands
from tfw.config import TFWENV
from tfw.config.log import TFWLog
from tao.config import TAOENV
from tfw.logging import Log, Logger, LogFormatter, VerboseLogFormatter
LOG = logging.getLogger(__name__)
@ -114,7 +115,10 @@ class MessageFSMStepsEventHandler(FSMAwareEventHandler):
def main():
# pylint: disable=unused-variable
TFWLog().start()
Logger([
Log(stderr, LogFormatter(20)),
Log(TFWENV.LOGFILE, VerboseLogFormatter())
]).start()
# TFW component EventHandlers (builtins, required for their respective functionalities)
fsm = FSMManagingEventHandler( # TFW FSM

View File

@ -1,11 +1,13 @@
import logging
from sys import stderr
from signal import signal, SIGTERM, SIGINT
from tornado.ioloop import IOLoop
from tfw.event_handlers import EventHandlerBase
from tfw.builtins import PipeIOEventHandler
from tfw.config.log import TFWLog
from tfw.config import TFWENV
from tfw.logging import Log, Logger, LogFormatter, VerboseLogFormatter
from pipe_io_auxlib import (
SignMessagePipeIOEventHandler, VerifyMessagePipeIOEventHandler,
@ -18,8 +20,11 @@ LOG = logging.getLogger(__name__)
if __name__ == '__main__':
# pylint: disable=pointless-string-statement
TFWLog().start()
Logger([
Log(stderr, LogFormatter(20)),
Log(TFWENV.LOGFILE, VerboseLogFormatter())
]).start()
"""
Creates general purpose pipes.
The first parameter associates the receiving pipe with a key, which is