This repository has been archived by the owner on Jul 30, 2019. It is now read-only.
/
exported.go
162 lines (133 loc) · 4.64 KB
/
exported.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
// Copyright (C) 2018 MediBloc
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>
package logging
import "github.com/sirupsen/logrus"
// WithField creates an entry and adds a field to it. If you want multiple
// fields, use `WithFields`.
//
// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
// or Panic on the Entry it returns.
func WithField(key string, value interface{}) *logrus.Entry {
return vLog().WithField(key, value)
}
// WithFields creates an entry and adds multiple fields to it. This is simply
// a helper for `WithField`, invoking it once for each field.
//
// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
// or Panic on the Entry it returns.
func WithFields(fields logrus.Fields) *logrus.Entry {
return vLog().WithFields(fields)
}
// WithError creates an entry and adds an error to it, using the value defined
// in ErrorKey as key.
func WithError(err error) *logrus.Entry {
return vLog().WithError(err)
}
// Debugf logs a message at level Debug on the verbose logger.
func Debugf(format string, args ...interface{}) {
vLog().Debugf(format, args...)
}
// Infof logs a message at level Info on the verbose logger.
func Infof(format string, args ...interface{}) {
vLog().Infof(format, args...)
}
// Printf logs a message at level Info on the verbose logger.
func Printf(format string, args ...interface{}) {
vLog().Printf(format, args...)
}
// Warnf logs a message at level Warn on the verbose logger.
func Warnf(format string, args ...interface{}) {
vLog().Warnf(format, args...)
}
// Warningf logs a message at level Warn on the verbose logger.
func Warningf(format string, args ...interface{}) {
vLog().Warningf(format, args...)
}
// Errorf logs a message at level Error on the verbose logger.
func Errorf(format string, args ...interface{}) {
vLog().Errorf(format, args...)
}
// Fatalf logs a message at level Fatal on the verbose logger.
func Fatalf(format string, args ...interface{}) {
vLog().Fatalf(format, args...)
}
// Panicf logs a message at level Panic on the verbose logger.
func Panicf(format string, args ...interface{}) {
vLog().Panicf(format, args...)
}
// Debug logs a message at level Debug on the verbose logger.
func Debug(args ...interface{}) {
vLog().Debug(args...)
}
// Info logs a message at level Info on the verbose logger.
func Info(args ...interface{}) {
vLog().Info(args...)
}
// Print logs a message at level Info on the verbose logger.
func Print(args ...interface{}) {
vLog().Print(args...)
}
// Warn logs a message at level Warn on the verbose logger.
func Warn(args ...interface{}) {
vLog().Warn(args...)
}
// Warning logs a message at level Warn on the verbose logger.
func Warning(args ...interface{}) {
vLog().Warning(args...)
}
// Error logs a message at level Error on the verbose logger.
func Error(args ...interface{}) {
vLog().Error(args...)
}
// Fatal logs a message at level Fatal on the verbose logger.
func Fatal(args ...interface{}) {
vLog().Fatal(args...)
}
// Panic logs a message at level Panic on the verbose logger.
func Panic(args ...interface{}) {
vLog().Panic(args...)
}
// Debugln logs a message at level Debug on the verbose logger.
func Debugln(args ...interface{}) {
vLog().Debugln(args...)
}
// Infoln logs a message at level Info on the verbose logger.
func Infoln(args ...interface{}) {
vLog().Infoln(args...)
}
// Println logs a message at level Info on the verbose logger.
func Println(args ...interface{}) {
vLog().Println(args...)
}
// Warnln logs a message at level Warn on the verbose logger.
func Warnln(args ...interface{}) {
vLog().Warnln(args...)
}
// Warningln logs a message at level Warn on the verbose logger.
func Warningln(args ...interface{}) {
vLog().Warningln(args...)
}
// Errorln logs a message at level Error on the verbose logger.
func Errorln(args ...interface{}) {
vLog().Errorln(args...)
}
// Fatalln logs a message at level Fatal on the verbose logger.
func Fatalln(args ...interface{}) {
vLog().Fatalln(args...)
}
// Panicln logs a message at level Panic on the verbose logger.
func Panicln(args ...interface{}) {
vLog().Panicln(args...)
}