forked from schollz/logger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger_js.go
38 lines (31 loc) · 834 Bytes
/
logger_js.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//+build js
package logger
import (
"fmt"
"syscall/js"
)
func (l *Logger) Tracef(format string, v ...interface{}) {
if l.traceEnabled {
js.Global().Get("console").Call("trace", fmt.Sprintf(format, v...))
}
}
func (l *Logger) Debugf(format string, v ...interface{}) {
if l.debugEnable {
js.Global().Get("console").Call("debug", fmt.Sprintf(format, v...))
}
}
func (l *Logger) Infof(format string, v ...interface{}) {
if l.infoEnabled {
js.Global().Get("console").Call("info", fmt.Sprintf(format, v...))
}
}
func (l *Logger) Warnf(format string, v ...interface{}) {
if l.warnEnabled {
js.Global().Get("console").Call("warn", fmt.Sprintf(format, v...))
}
}
func (l *Logger) Errorf(format string, v ...interface{}) {
if l.errorEnabled {
js.Global().Get("console").Call("error", fmt.Sprintf(format, v...))
}
}