Vasiliy Tolstov
14c97d59c1
* add many options helpers * fix noop client to allow publish messages to topic in broker * fix noop server to allow registering in registry * fix noop server to allow subscribe to topic in broker * fix new service initialization Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
// Package log provides a log interface
|
|
package logger
|
|
|
|
var (
|
|
// Default logger
|
|
DefaultLogger Logger = NewHelper(NewLogger())
|
|
)
|
|
|
|
// Logger is a generic logging interface
|
|
type Logger interface {
|
|
// Init initialises options
|
|
Init(opts ...Option) error
|
|
// V compare provided verbosity level with current log level
|
|
V(level Level) bool
|
|
// The Logger options
|
|
Options() Options
|
|
// Fields set fields to always be logged
|
|
Fields(fields map[string]interface{}) Logger
|
|
// Log writes a log entry
|
|
Log(level Level, v ...interface{})
|
|
// Logf writes a formatted log entry
|
|
Logf(level Level, format string, v ...interface{})
|
|
// String returns the name of logger
|
|
String() string
|
|
}
|
|
|
|
func Init(opts ...Option) error {
|
|
return DefaultLogger.Init(opts...)
|
|
}
|
|
|
|
func Fields(fields map[string]interface{}) Logger {
|
|
return DefaultLogger.Fields(fields)
|
|
}
|
|
|
|
func Log(level Level, v ...interface{}) {
|
|
DefaultLogger.Log(level, v...)
|
|
}
|
|
|
|
func Logf(level Level, format string, v ...interface{}) {
|
|
DefaultLogger.Logf(level, format, v...)
|
|
}
|
|
|
|
func String() string {
|
|
return DefaultLogger.String()
|
|
}
|