Documentation ¶
Overview ¶
Copyright 2019 The arhat.dev Authors.
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.
Copyright 2019 The arhat.dev Authors.
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.
Index ¶
- Constants
- Variables
- func FlagsForLogConfig(prefix string, c *Config) *pflag.FlagSet
- func SetDefaultLogger(cs ConfigSet) error
- type Config
- type ConfigSet
- type Destination
- type Field
- type Interface
- type Level
- type Logger
- func (l *Logger) D(msg string, fields ...Field)
- func (l *Logger) E(msg string, fields ...Field)
- func (l *Logger) Enabled(level Level) bool
- func (l *Logger) Flush() error
- func (l *Logger) I(msg string, fields ...Field)
- func (l *Logger) V(msg string, fields ...Field)
- func (l *Logger) WithFields(fields ...Field) Interface
- func (l *Logger) WithName(name string) Interface
- type Structure
Constants ¶
const ( LevelVerbose = Level(zapcore.DebugLevel) LevelDebug = Level(zapcore.InfoLevel) LevelInfo = Level(zapcore.WarnLevel) LevelError = Level(zapcore.ErrorLevel) LevelSilent = Level(zapcore.FatalLevel + 1) )
Log levels
const (
TimeLayout = time.RFC3339Nano
)
TimeLayout used by this logger
Variables ¶
var ( Any = zap.Any Error = zap.Error NamedError = zap.NamedError Binary = zap.Binary Bool = zap.Bool ByteString = zap.ByteString Complex128 = zap.Complex128 Complex64 = zap.Complex64 Float64 = zap.Float64 Float32 = zap.Float32 Int = zap.Int Int64 = zap.Int64 Int32 = zap.Int32 Int16 = zap.Int16 Int8 = zap.Int8 String = zap.String Strings = zap.Strings Uint = zap.Uint Uint64 = zap.Uint64 Uint32 = zap.Uint32 Uint16 = zap.Uint16 Uint8 = zap.Uint8 Uintptr = zap.Uintptr Time = zap.Time Duration = zap.Duration )
log fields for zap logger
Functions ¶
func SetDefaultLogger ¶
Types ¶
type Config ¶
type Config struct { Level string `json:"level" yaml:"level"` Format string `json:"format" yaml:"format"` KubeLog bool `json:"kubeLog" yaml:"kubeLog"` Destination `json:",inline" yaml:",inline"` }
type Destination ¶
type Destination struct {
File string `json:"file" yaml:"file"`
}
type Interface ¶
type Interface interface { // Enabled check if level is enabled Enabled(level Level) bool // WithName return a logger which shares config and runtime but with different name WithName(name string) Interface // WithFields return a logger with predefined fields WithFields(fields ...Field) Interface // V is the verbose level, should be used in library and not useful or untested stuff // such as showing a call started, printing some internal values for inspection V(msg string, fields ...Field) // D is the debug level, should be used for information D(msg string, fields ...Field) // I is the info level, should be used to indicate application state, show important messages I(msg string, fields ...Field) // E is the error level, should only be used to report unexpected or fatal error, will print // a stacktrace when used E(msg string, fields ...Field) // Flush logger Flush() error }
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}