mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-python
synced 2026-01-15 01:52:56 +01:00
log.py: Add support for flag "date"
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
5578bd486a
commit
2171e1e16e
1 changed files with 5 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ import syslog
|
||||||
import sys
|
import sys
|
||||||
import inspect
|
import inspect
|
||||||
from os.path import basename
|
from os.path import basename
|
||||||
|
from datetime import datetime
|
||||||
from . import misc
|
from . import misc
|
||||||
|
|
||||||
# --- python 2 / 3 compatibility stuff
|
# --- python 2 / 3 compatibility stuff
|
||||||
|
|
@ -38,6 +39,7 @@ CONSOLE_FONT_BLINK = '\033[5m'
|
||||||
CONSOLE_FONT_OFF = '\033[m'
|
CONSOLE_FONT_OFF = '\033[m'
|
||||||
|
|
||||||
f_position = 'position'
|
f_position = 'position'
|
||||||
|
f_date = 'date'
|
||||||
f_stderr = 'stderr'
|
f_stderr = 'stderr'
|
||||||
f_stdout = 'stdout'
|
f_stdout = 'stdout'
|
||||||
f_prio = 'prio'
|
f_prio = 'prio'
|
||||||
|
|
@ -100,6 +102,9 @@ def slog(prio, *args, **kwargs): # export
|
||||||
color_on = ''
|
color_on = ''
|
||||||
color_off = ''
|
color_off = ''
|
||||||
|
|
||||||
|
if f_date in _flags:
|
||||||
|
msg += datetime.now().strftime("%b %d %H:%M:%S.%f ")
|
||||||
|
|
||||||
if f_prio in _flags:
|
if f_prio in _flags:
|
||||||
msg += _short_prio_str[prio] + ' '
|
msg += _short_prio_str[prio] + ' '
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue