forked from peterlabuschagne/jettison
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deprecated.go
79 lines (66 loc) · 2.18 KB
/
deprecated.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package log
import (
"context"
"fmt"
"os"
)
// Print wraps a call to fmt.Sprint in a jettison log and writes it to the logger.
// Deprecated: Use log.Info or log.Error instead.
func Print(v ...interface{}) {
print(v...)
}
// Printf wraps a call to fmt.Sprintf in a jettison log and writes it to the logger.
// Deprecated: Use log.Info or log.Error instead.
func Printf(format string, v ...interface{}) {
printf(format, v...)
}
// Println wraps a call to fmt.Sprintln in a jettison log and writes it to the logger.
// Deprecated: Use log.Info or log.Error instead.
func Println(v ...interface{}) {
println(v...)
}
// Panic is equivalent to log.Print followed by a panic.
// Deprecated: Use log.Info or log.Error instead and panic manually.
func Panic(v ...interface{}) {
panic(print(v...))
}
// Panicf is equivalent to log.Printf followed by a panic.
// Deprecated: Use log.Info or log.Error instead and panic manually.
func Panicf(format string, v ...interface{}) {
panic(printf(format, v...))
}
// Panicln is equivalent to log.Println followed by a panic.
// Deprecated: Use log.Info or log.Error instead and panic manually.
func Panicln(v ...interface{}) {
panic(println(v...))
}
// Fatal is equivalent to log.Print followed by a call to os.Exit(1).
// Deprecated: Use log.Info or log.Error instead and exit manually.
func Fatal(v ...interface{}) {
print(v...)
os.Exit(1)
}
// Fatalf is equivalent to log.Printf followed by a call to os.Exit(1).
// Deprecated: Use log.Info or log.Error instead and exit manually.
func Fatalf(format string, v ...interface{}) {
printf(format, v...)
os.Exit(1)
}
// Fatalln is equivalent to log.Println followed by a call to os.Exit(1).
// Deprecated: Use log.Info or log.Error instead and exit manually.
func Fatalln(v ...interface{}) {
println(v...)
os.Exit(1)
}
func print(v ...interface{}) string {
l := newEntry(fmt.Sprint(v...), LevelInfo, 3)
return logger.Log(context.TODO(), l)
}
func printf(format string, v ...interface{}) string {
l := newEntry(fmt.Sprintf(format, v...), LevelInfo, 3)
return logger.Log(context.TODO(), l)
}
func println(v ...interface{}) string {
l := newEntry(fmt.Sprintln(v...), LevelInfo, 3)
return logger.Log(context.TODO(), l)
}