Documentation
¶
Overview ¶
Package go_vector_logger provides a logger that can write logs to stdout and send them to a remote Vector instance.
Index ¶
- Constants
- type Message
- type Options
- type VectorLogger
- func (l *VectorLogger) Debug(message string)
- func (l *VectorLogger) Debugf(format string, v ...interface{})
- func (l *VectorLogger) Error(message string)
- func (l *VectorLogger) Errorf(format string, v ...interface{})
- func (l *VectorLogger) Fatal(message string)
- func (l *VectorLogger) FatalError(message error)
- func (l *VectorLogger) Fatalf(format string, v ...interface{})
- func (l *VectorLogger) Info(message string)
- func (l *VectorLogger) Infof(format string, v ...interface{})
- func (l *VectorLogger) Init(application string, level string, vectorHost string, vectorPort int64)
- func (l *VectorLogger) Warn(message string)
- func (l *VectorLogger) Warnf(format string, v ...interface{})
Constants ¶
const ( DEBUG string = "DEBUG" INFO = "INFO" WARN = "WARN" ERROR = "ERROR" FATAL = "FATAL" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct { Timestamp string `json:"timestamp"` // Log timestamp. Application string `json:"application"` // Application name. Level string `json:"level"` // Log level. Message string `json:"message"` // Log message. }
Message represents a log message.
type Options ¶ added in v0.5.0
type Options struct { Writer io.Writer // Instead of over the network, write the log messages just to this writer AlsoPrintMessages bool // In addition to the specific network, also log any messages to stdout }
Options list different options you can optionally pass into New
type VectorLogger ¶
type VectorLogger struct { Application string // Application name. Level string // Log level. VectorHost string // Vector host. VectorPort int64 // Vector port. Options Options }
VectorLogger represents a logger instance.
func (*VectorLogger) Debug ¶
func (l *VectorLogger) Debug(message string)
Debug logs a debug message.
func (*VectorLogger) Debugf ¶ added in v0.3.0
func (l *VectorLogger) Debugf(format string, v ...interface{})
Debugf logs a debug message with a formatted string.
func (*VectorLogger) Error ¶
func (l *VectorLogger) Error(message string)
Error logs an error message.
func (*VectorLogger) Errorf ¶ added in v0.3.0
func (l *VectorLogger) Errorf(format string, v ...interface{})
Errorf logs an error message with a formatted string.
func (*VectorLogger) Fatal ¶ added in v0.6.0
func (l *VectorLogger) Fatal(message string)
Fatal logs an error message.
func (*VectorLogger) FatalError ¶ added in v0.6.0
func (l *VectorLogger) FatalError(message error)
Fatal logs an error message.
func (*VectorLogger) Fatalf ¶ added in v0.6.0
func (l *VectorLogger) Fatalf(format string, v ...interface{})
Errorf logs an error message with a formatted string.
func (*VectorLogger) Infof ¶ added in v0.3.0
func (l *VectorLogger) Infof(format string, v ...interface{})
Infof logs an info message with a formatted string.
func (*VectorLogger) Init ¶
func (l *VectorLogger) Init(application string, level string, vectorHost string, vectorPort int64)
Init initializes the logger instance. This method is deprecated; use New() with a Options struct for more flexibility.
func (*VectorLogger) Warn ¶ added in v0.4.0
func (l *VectorLogger) Warn(message string)
Warn logs an warning message.
func (*VectorLogger) Warnf ¶ added in v0.4.0
func (l *VectorLogger) Warnf(format string, v ...interface{})
Warnf logs an warning message with a formatted string.