New logging

This commit is contained in:
Dirk Alders 2020-12-23 18:57:49 +01:00
parent 2c8cbf567e
commit 12aeefae37
9 changed files with 22 additions and 33 deletions

8
.gitignore vendored
View File

@ -1,11 +1,15 @@
config.py
.settings
*~
messages.*
# ---> Python # ---> Python
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
__pycache__/ __pycache__/
*.py[cod] *.py[cod]
*$py.class *$py.class
config.py
# C extensions # C extensions
*.so *.so

View File

@ -1,36 +1,21 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: UTF-8 -*- # -*- coding: UTF-8 -*-
import geo import report
import socket_protocol
import state_machine
import stringtools
import task
import tcp_socket
secret = b'give_a_secret_string_here' secret = b'give_a_secret_string_here'
server_ip = '127.0.0.1' server_ip = '127.0.0.1'
server_port = 10001 server_port = 10001
# Logging
#
APP_NAME = 'leyk'
LOG_TARGET_STDOUT = 'stdout' LOG_TARGET_STDOUT = 'stdout'
LOG_TARGET_FILE = 'logfile' LOG_TARGET_FILE = 'logfile'
LOG_TARGET = LOG_TARGET_STDOUT LOGTARGET = LOG_TARGET_STDOUT
LOGHOST = 'localhost'
LOGPORT = 19996
SHORT_FMT = "%(asctime)s: %(levelname)-7s - %(message)s" formatter = report.LONG_FMT
""" A short formatter including the most important information"""
LONG_FMT = """~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
File "%(pathname)s", line %(lineno)d, in %(funcName)s
%(asctime)s: %(levelname)-7s - %(message)s"""
""" A long formatter which results in links to the source code inside Eclipse"""
loggers = (
('APP', 'DEBUG'),
(geo.logger_name, 'DEBUG'),
(socket_protocol.logger_name, 'DEBUG'),
(state_machine.logger_name, 'DEBUG'),
(stringtools.logger_name, 'DEBUG'),
(task.logger_name, 'DEBUG'),
(tcp_socket.logger_name, 'DEBUG'),
)
formatter = LONG_FMT

View File

@ -10,7 +10,7 @@ import time
if __name__ == '__main__': if __name__ == '__main__':
report.appLoggingConfigure(os.path.dirname(__file__), config.LOG_TARGET, config.loggers) report.appLoggingConfigure(os.path.dirname(__file__), config.LOGTARGET, ((config.APP_NAME, 'DEBUG'), ), fmt=config.formatter, host=config.LOGHOST, port=config.LOGPORT)
s = tcp_socket.tcp_server_stp(config.server_ip, port=config.server_port) s = tcp_socket.tcp_server_stp(config.server_ip, port=config.server_port)
prot = protocol.my_server_protocol(s, secret=config.secret) prot = protocol.my_server_protocol(s, secret=config.secret)
while True: while True:

2
report

@ -1 +1 @@
Subproject commit ce174339bc61a57dbb1c152f329d01ec4a5e1040 Subproject commit 25889f225b3593d515e37bebffef21458c961f64

@ -1 +1 @@
Subproject commit b0857e4569c34b9b644f5640731be0c413ce54d4 Subproject commit 8a8522d26b486b005f65e7e542742e898f1109e7

@ -1 +1 @@
Subproject commit 362cb1fc1772f8fae4629ebbd8828d5c63689ecd Subproject commit 561b564b3dc9298936de5b4b51267e56d86ac426

@ -1 +1 @@
Subproject commit d5f9931bcab942ac84d8f09b1559995da0d2676c Subproject commit 76d8ae9b1bfd894bc5f4b830394ce0552120a508

2
task

@ -1 +1 @@
Subproject commit d3fbc5934051ab165723ca37e8f02596329f174a Subproject commit bbc3c6f93588942087d617e33bc5797041ae2658

@ -1 +1 @@
Subproject commit 62f13e2d878b09b81d094c2f77dbd830d72be2c7 Subproject commit 576494b2008b857ed9b6c4bb3f162b5c73cf4b33