Log a timestamp as well when printing error messages from python
This commit is contained in:
+11
-2
@@ -3,6 +3,7 @@
|
||||
# License: GPL v3 Copyright: 2016, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
import atexit
|
||||
import datetime
|
||||
import errno
|
||||
import fcntl
|
||||
import math
|
||||
@@ -19,8 +20,7 @@ from time import monotonic
|
||||
|
||||
from .constants import appname, is_macos, is_wayland
|
||||
from .fast_data_types import (
|
||||
GLSL_VERSION, redirect_std_streams, x11_display,
|
||||
x11_window_id
|
||||
GLSL_VERSION, redirect_std_streams, x11_display, x11_window_id
|
||||
)
|
||||
from .rgb import Color, to_color
|
||||
|
||||
@@ -40,6 +40,15 @@ def safe_print(*a, **k):
|
||||
pass
|
||||
|
||||
|
||||
def log_error(*a, **k):
|
||||
try:
|
||||
msg = k.get('sep', ' ').join(map(str, a)) + k.get('end', '\n')
|
||||
msg = datetime.datetime.now().strftime('[%j %H:%M:%S.%f] ') + msg
|
||||
sys.stderr.write(msg)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def ceil_int(x):
|
||||
return int(math.ceil(x))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user