Documentation ¶
Overview ¶
Copyright 2016 Ville Koskela
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 2016 Ville Koskela ¶
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 2016 Ville Koskela ¶
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 2016 Ville Koskela ¶
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 2016 Ville Koskela ¶
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 2016 Ville Koskela ¶
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 2016 Ville Koskela ¶
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 2016 Ville Koskela ¶
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 2016 Ville Koskela ¶
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
- func Flags() int
- func Output(calldepth int, s string) error
- func Prefix() string
- func SetFlags(flag int)
- func SetOutput(w io.Writer)
- func SetPrefix(prefix string)
- type DefaultLogBuilder
- func (dlb *DefaultLogBuilder) AddContext(key string, value interface{}) LogBuilder
- func (dlb *DefaultLogBuilder) AddData(key string, value interface{}) LogBuilder
- func (dlb *DefaultLogBuilder) Log()
- func (dlb *DefaultLogBuilder) SetError(err error) LogBuilder
- func (dlb *DefaultLogBuilder) SetEvent(event string) LogBuilder
- func (dlb *DefaultLogBuilder) SetMessage(message string) LogBuilder
- type Formatter
- func (sf *Formatter) Format(e *logrus.Entry) (result []byte, err error)
- func (sf *Formatter) InjectContextHost() bool
- func (sf *Formatter) InjectContextLogger() bool
- func (sf *Formatter) InjectContextProcess() bool
- func (sf *Formatter) LogEventName() string
- func (sf *Formatter) SetInjectContextHost(v bool)
- func (sf *Formatter) SetInjectContextLogger(v bool)
- func (sf *Formatter) SetInjectContextProcess(v bool)
- func (sf *Formatter) SetLogEventName(v string)
- type LogBuilder
- type Logger
- func (l *Logger) Debug(args ...interface{})
- func (l *Logger) DebugBuilder() LogBuilder
- func (l *Logger) Debugf(format string, args ...interface{})
- func (l *Logger) Debugln(args ...interface{})
- func (l *Logger) Error(args ...interface{})
- func (l *Logger) ErrorBuilder() LogBuilder
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Errorln(args ...interface{})
- func (l *Logger) Fatal(args ...interface{})
- func (l *Logger) FatalBuilder() LogBuilder
- func (l *Logger) Fatalf(format string, args ...interface{})
- func (l *Logger) Fatalln(args ...interface{})
- func (l *Logger) Flags() int
- func (l *Logger) Info(args ...interface{})
- func (l *Logger) InfoBuilder() LogBuilder
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) Infoln(args ...interface{})
- func (l *Logger) Output(calldepth int, s string) error
- func (l *Logger) Panic(args ...interface{})
- func (l *Logger) PanicBuilder() LogBuilder
- func (l *Logger) Panicf(format string, args ...interface{})
- func (l *Logger) Panicln(args ...interface{})
- func (l *Logger) Prefix() string
- func (l *Logger) Print(args ...interface{})
- func (l *Logger) Printf(format string, args ...interface{})
- func (l *Logger) Println(args ...interface{})
- func (l *Logger) SetFlags(flag int)
- func (l *Logger) SetPrefix(prefix string)
- func (l *Logger) Warn(args ...interface{})
- func (l *Logger) WarnBuilder() LogBuilder
- func (l *Logger) Warnf(format string, args ...interface{})
- func (l *Logger) Warning(args ...interface{})
- func (l *Logger) WarningBuilder() LogBuilder
- func (l *Logger) Warningf(format string, args ...interface{})
- func (l *Logger) Warningln(args ...interface{})
- func (l *Logger) Warnln(args ...interface{})
- func (l *Logger) WithError(err error) *logrus.Entry
- func (l *Logger) WithField(key string, value interface{}) *logrus.Entry
- func (l *Logger) WithFields(fields logrus.Fields) *logrus.Entry
- type MapsMarker
- func (smm *MapsMarker) Encode(logger *logrus.Logger, event string, loggerName string, ...) *logrus.Entry
- func (smm *MapsMarker) ParseContext(e *logrus.Entry) map[string]interface{}
- func (smm *MapsMarker) ParseData(e *logrus.Entry) map[string]interface{}
- func (smm *MapsMarker) ParseError(e *logrus.Entry) error
- func (smm *MapsMarker) ParseEvent(e *logrus.Entry) string
- func (smm *MapsMarker) ParseLoggerName(e *logrus.Entry) string
- type Marker
- type NoOpLogBuilder
- func (nolb *NoOpLogBuilder) AddContext(key string, value interface{}) LogBuilder
- func (nolb *NoOpLogBuilder) AddData(key string, value interface{}) LogBuilder
- func (nolb *NoOpLogBuilder) Log()
- func (nolb *NoOpLogBuilder) SetError(err error) LogBuilder
- func (nolb *NoOpLogBuilder) SetEvent(event string) LogBuilder
- func (nolb *NoOpLogBuilder) SetMessage(message string) LogBuilder
Constants ¶
const ( EVENT_DATA_EVENT_KEY string = "event" EVENT_DATA_LOGGER_KEY string = "logger" EVENT_DATA_DATA_KEY string = "data" EVENT_DATA_CONTEXT_KEY string = "context" EVENT_DATA_ERROR_KEY string = "error" )
const ( // The field name containing a descriptor of the field format. MarkerKey string = "__gosteno.marker__" )
Variables ¶
This section is empty.
Functions ¶
func Flags ¶
func Flags() int
Flags from standard Go log library. This is a no-op. Provided for compatibility.
func Prefix ¶
func Prefix() string
Prefix from standard Go log library. This is a no-op. Provided for compatibility.
func SetFlags ¶
func SetFlags(flag int)
SetFlags from standard Go log library. This is a no-op. Provided for compatibility.
Types ¶
type DefaultLogBuilder ¶
type DefaultLogBuilder struct {
// contains filtered or unexported fields
}
DefaultLogBuilder is the default LogBuilder implementation that satisfies the LogBuilder contract.
func NewDefaultLogBuilder ¶
func (*DefaultLogBuilder) AddContext ¶
func (dlb *DefaultLogBuilder) AddContext(key string, value interface{}) LogBuilder
func (*DefaultLogBuilder) AddData ¶
func (dlb *DefaultLogBuilder) AddData(key string, value interface{}) LogBuilder
func (*DefaultLogBuilder) Log ¶
func (dlb *DefaultLogBuilder) Log()
func (*DefaultLogBuilder) SetError ¶
func (dlb *DefaultLogBuilder) SetError(err error) LogBuilder
func (*DefaultLogBuilder) SetEvent ¶
func (dlb *DefaultLogBuilder) SetEvent(event string) LogBuilder
func (*DefaultLogBuilder) SetMessage ¶
func (dlb *DefaultLogBuilder) SetMessage(message string) LogBuilder
type Formatter ¶
type Formatter struct {
// contains filtered or unexported fields
}
func NewFormatter ¶
func NewFormatter() *Formatter
func (*Formatter) InjectContextHost ¶
func (*Formatter) InjectContextLogger ¶
func (*Formatter) InjectContextProcess ¶
func (*Formatter) LogEventName ¶
func (*Formatter) SetInjectContextHost ¶
func (*Formatter) SetInjectContextLogger ¶
func (*Formatter) SetInjectContextProcess ¶
func (*Formatter) SetLogEventName ¶
type LogBuilder ¶
type LogBuilder interface { // Event setter. SetEvent(string) LogBuilder // Message setter. SetMessage(string) LogBuilder // Error setter. SetError(error) LogBuilder // Data adder. AddData(string, interface{}) LogBuilder // Context adder. AddContext(string, interface{}) LogBuilder // Log message. Log() }
LogBuilder interface for assembling log messages.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger implementation. Interface compatible with standard Go log and github.com/Sirupsen/logrus. However, the power of the implementation is in the methods returning LogBuilder instances. The "Print" methods are mapped to the info level. As with other implementations fatal will exit and panic will halt.
func (*Logger) Debug ¶
func (l *Logger) Debug(args ...interface{})
Debug from github.com/Sirupsen/logrus library. Provided for compatibility.
func (*Logger) DebugBuilder ¶
func (l *Logger) DebugBuilder() LogBuilder
Debug with LogBuilder. Recommended.
func (*Logger) Debugln ¶
func (l *Logger) Debugln(args ...interface{})
Debugln from github.com/Sirupsen/logrus library. Provided for compatibility.
func (*Logger) Error ¶
func (l *Logger) Error(args ...interface{})
Error from github.com/Sirupsen/logrus library. Provided for compatibility.
func (*Logger) ErrorBuilder ¶
func (l *Logger) ErrorBuilder() LogBuilder
Error with LogBuilder. Recommended.
func (*Logger) Errorln ¶
func (l *Logger) Errorln(args ...interface{})
Errorln from github.com/Sirupsen/logrus library. Provided for compatibility.
func (*Logger) Fatal ¶
func (l *Logger) Fatal(args ...interface{})
Fatal from standard Go log library. This implementation like the standard library causes the program to exit. Provided for compatibility.
func (*Logger) FatalBuilder ¶
func (l *Logger) FatalBuilder() LogBuilder
Fatal with LogBuilder. Recommended. This implementation like the standard library causes the program to exit.
func (*Logger) Fatalf ¶
Fatalf from standard Go log library. This implementation like the standard library causes the program to exit. Provided for compatibility.
func (*Logger) Fatalln ¶
func (l *Logger) Fatalln(args ...interface{})
Fatalln from standard Go log library. This implementation like the standard library causes the program to exit. Provided for compatibility.
func (*Logger) Flags ¶
Flags from standard Go log library. This is a no-op. Provided for compatibility.
func (*Logger) Info ¶
func (l *Logger) Info(args ...interface{})
Info from github.com/Sirupsen/logrus library. Provided for compatibility.
func (*Logger) InfoBuilder ¶
func (l *Logger) InfoBuilder() LogBuilder
Info with LogBuilder. Recommended.
func (*Logger) Infoln ¶
func (l *Logger) Infoln(args ...interface{})
Infoln from github.com/Sirupsen/logrus library. Provided for compatibility.
func (*Logger) Output ¶
Output from standard Go log library. This is mapped to Info without the stack trace. Provided for compatibility.
func (*Logger) Panic ¶
func (l *Logger) Panic(args ...interface{})
Panic from standard Go log library. This implementation like the standard library causes the program to panic. Provided for compatibility.
func (*Logger) PanicBuilder ¶
func (l *Logger) PanicBuilder() LogBuilder
Panic with LogBuilder. Recommended. This implementation like the standard library causes the program to panic.
func (*Logger) Panicf ¶
Panicf from standard Go log library. This implementation like the standard library causes the program to panic. Provided for compatibility.
func (*Logger) Panicln ¶
func (l *Logger) Panicln(args ...interface{})
Panicln from standard Go log library. This implementation like the standard library causes the program to panic. Provided for compatibility.
func (*Logger) Prefix ¶
Prefix from standard Go log library. This is a no-op. Provided for compatibility.
func (*Logger) Print ¶
func (l *Logger) Print(args ...interface{})
Print from standard Go log library. Provided for compatibility.
func (*Logger) Println ¶
func (l *Logger) Println(args ...interface{})
Println from standard Go log library. Provided for compatibility.
func (*Logger) SetFlags ¶
SetFlags from standard Go log library. This is a no-op. Provided for compatibility.
func (*Logger) SetPrefix ¶
SetPrefix from standard Go log library. This is a no-op. Provided for compatibility.
func (*Logger) Warn ¶
func (l *Logger) Warn(args ...interface{})
Warn from github.com/Sirupsen/logrus library. Provided for compatibility.
func (*Logger) WarnBuilder ¶
func (l *Logger) WarnBuilder() LogBuilder
Warn with LogBuilder. Recommended.
func (*Logger) Warning ¶
func (l *Logger) Warning(args ...interface{})
Warning from github.com/Sirupsen/logrus library. Provided for compatibility.
func (*Logger) WarningBuilder ¶
func (l *Logger) WarningBuilder() LogBuilder
Warning with LogBuilder. Recommended.
func (*Logger) Warningf ¶
Warningf from github.com/Sirupsen/logrus library. Provided for compatibility.
func (*Logger) Warningln ¶
func (l *Logger) Warningln(args ...interface{})
Warningln from github.com/Sirupsen/logrus library. Provided for compatibility.
func (*Logger) Warnln ¶
func (l *Logger) Warnln(args ...interface{})
Warnln from github.com/Sirupsen/logrus library. Provided for compatibility.
func (*Logger) WithError ¶
WithError from github.com/Sirupsen/logrus library. Provided for compatibility.
type MapsMarker ¶
type MapsMarker struct{}
Maps marker implementation.
var ( // The marker for steno as maps format descriptor. MarkerMaps *MapsMarker = new(MapsMarker) )
func (*MapsMarker) Encode ¶
func (smm *MapsMarker) Encode( logger *logrus.Logger, event string, loggerName string, data map[string]interface{}, context map[string]interface{}, err error) *logrus.Entry
Encode.
func (*MapsMarker) ParseContext ¶
func (smm *MapsMarker) ParseContext(e *logrus.Entry) map[string]interface{}
Parse context from event.
func (*MapsMarker) ParseData ¶
func (smm *MapsMarker) ParseData(e *logrus.Entry) map[string]interface{}
Parse data from event.
func (*MapsMarker) ParseError ¶
func (smm *MapsMarker) ParseError(e *logrus.Entry) error
Parse data from event.
func (*MapsMarker) ParseEvent ¶
func (smm *MapsMarker) ParseEvent(e *logrus.Entry) string
Parse event name from event.
func (*MapsMarker) ParseLoggerName ¶
func (smm *MapsMarker) ParseLoggerName(e *logrus.Entry) string
Parse logger name from event.
type Marker ¶
type Marker interface { // Parse event name from event. ParseEvent(e *logrus.Entry) string // Parse logger from event. ParseLoggerName(e *logrus.Entry) string // Parse data from event ParseData(e *logrus.Entry) map[string]interface{} // Parse context from event ParseContext(e *logrus.Entry) map[string]interface{} // Parse error from event ParseError(e *logrus.Entry) error }
Marker interface.
type NoOpLogBuilder ¶
type NoOpLogBuilder struct { }
NoOpLogBuilder is a LogBuilder implementation that satisfies the LogBuilder contract without empty implementations.
func (*NoOpLogBuilder) AddContext ¶
func (nolb *NoOpLogBuilder) AddContext(key string, value interface{}) LogBuilder
func (*NoOpLogBuilder) AddData ¶
func (nolb *NoOpLogBuilder) AddData(key string, value interface{}) LogBuilder
func (*NoOpLogBuilder) Log ¶
func (nolb *NoOpLogBuilder) Log()
func (*NoOpLogBuilder) SetError ¶
func (nolb *NoOpLogBuilder) SetError(err error) LogBuilder
func (*NoOpLogBuilder) SetEvent ¶
func (nolb *NoOpLogBuilder) SetEvent(event string) LogBuilder
func (*NoOpLogBuilder) SetMessage ¶
func (nolb *NoOpLogBuilder) SetMessage(message string) LogBuilder