Added line number
This commit is contained in:
parent
4eae2567ad
commit
7748c30f6a
1 changed files with 3 additions and 3 deletions
|
@ -1,7 +1,6 @@
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
from time import strftime
|
from time import strftime
|
||||||
from inspect import getmodule
|
from inspect import getmodule, stack, currentframe, getframeinfo
|
||||||
from inspect import stack
|
|
||||||
from sys import stderr
|
from sys import stderr
|
||||||
from sys import stdout
|
from sys import stdout
|
||||||
|
|
||||||
|
@ -80,7 +79,8 @@ def print_out(message, color, file):
|
||||||
module = getmodule(stack_[2][0]).__name__
|
module = getmodule(stack_[2][0]).__name__
|
||||||
CACHED_MODULES[stack_[2][0].f_code] = module
|
CACHED_MODULES[stack_[2][0].f_code] = module
|
||||||
if not print_fallback:
|
if not print_fallback:
|
||||||
print("[%s] %s: %s%s\033[0m" % (strftime("%H:%M:%S"), module, color, message), file=file)
|
print("[%s] %s:%i → %s%s\033[0m" % (strftime("%H:%M:%S"), module,
|
||||||
|
stack_[2][0].f_lineno, color, message), file=file)
|
||||||
file.flush()
|
file.flush()
|
||||||
else:
|
else:
|
||||||
print("[%s] %s: %s" % (strftime("%H:%M:%S"), module, message))
|
print("[%s] %s: %s" % (strftime("%H:%M:%S"), module, message))
|
||||||
|
|
Reference in a new issue