forked from etcd-io/etcd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.go
98 lines (78 loc) · 2.71 KB
/
commands.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
// Copyright 2013, Cong Ding. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// author: Cong Ding <dinggnu@gmail.com>
package logging
// Logln receives log request from the client. The request includes a set of
// variables.
func (logger *Logger) Log(level Level, v ...interface{}) {
// Don't delete this calling. The calling is used to keep the same
// calldepth for all the logging functions. The calldepth is used to
// get runtime information such as line number, function name, etc.
logger.log(level, v...)
}
// Logf receives log request from the client. The request has a string
// parameter to describe the format of output.
func (logger *Logger) Logf(level Level, format string, v ...interface{}) {
logger.logf(level, format, v...)
}
// Other quick commands for different level
func (logger *Logger) Critical(v ...interface{}) {
logger.log(CRITICAL, v...)
}
func (logger *Logger) Fatal(v ...interface{}) {
logger.log(CRITICAL, v...)
}
func (logger *Logger) Error(v ...interface{}) {
logger.log(ERROR, v...)
}
func (logger *Logger) Warn(v ...interface{}) {
logger.log(WARNING, v...)
}
func (logger *Logger) Warning(v ...interface{}) {
logger.log(WARNING, v...)
}
func (logger *Logger) Info(v ...interface{}) {
logger.log(INFO, v...)
}
func (logger *Logger) Debug(v ...interface{}) {
logger.log(DEBUG, v...)
}
func (logger *Logger) Notset(v ...interface{}) {
logger.log(NOTSET, v...)
}
func (logger *Logger) Criticalf(format string, v ...interface{}) {
logger.logf(CRITICAL, format, v...)
}
func (logger *Logger) Fatalf(format string, v ...interface{}) {
logger.logf(CRITICAL, format, v...)
}
func (logger *Logger) Errorf(format string, v ...interface{}) {
logger.logf(ERROR, format, v...)
}
func (logger *Logger) Warnf(format string, v ...interface{}) {
logger.logf(WARNING, format, v...)
}
func (logger *Logger) Warningf(format string, v ...interface{}) {
logger.logf(WARNING, format, v...)
}
func (logger *Logger) Infof(format string, v ...interface{}) {
logger.logf(INFO, format, v...)
}
func (logger *Logger) Debugf(format string, v ...interface{}) {
logger.logf(DEBUG, format, v...)
}
func (logger *Logger) Notsetf(format string, v ...interface{}) {
logger.logf(NOTSET, format, v...)
}