log: added timestamps

pull/1369/head
Mike 'Fuzzy' Partin 2019-07-29 07:34:23 -07:00 committed by Alexander Medvednikov
parent d87030972e
commit ff72d9104d
1 changed files with 8 additions and 4 deletions

View File

@ -46,7 +46,8 @@ pub fn (l Log) error(s string){
switch l.output {
case 'terminal':
f := term.red('E')
println('[$f]$s')
t := time.now()
println('[$f ${t.format()}] $s')
default:
l.log_file(s, 'E')
@ -59,7 +60,8 @@ pub fn (l Log) warn(s string){
switch l.output {
case 'terminal':
f := term.yellow('W')
println('[$f]$s')
t := time.now()
println('[$f ${t.format()}] $s')
default:
l.log_file(s, 'W')
@ -72,7 +74,8 @@ pub fn (l Log) info(s string){
switch l.output {
case 'terminal':
f := term.white('I')
println('[$f]$s')
t := time.now()
println('[$f ${t.format()}] $s')
default:
l.log_file(s, 'I')
@ -85,7 +88,8 @@ pub fn (l Log) debug(s string){
switch l.output {
case 'terminal':
f := term.blue('D')
println('[$f]$s')
t := time.now()
println('[$f ${t.format()}] $s')
default:
l.log_file(s, 'D')