Documentation ¶
Index ¶
- type GlogLogger
- func (l *GlogLogger) Debug(ctx context.Context, format string, args ...interface{})
- func (l *GlogLogger) DebugEnabled() bool
- func (l *GlogLogger) Error(ctx context.Context, format string, args ...interface{})
- func (l *GlogLogger) ErrorEnabled() bool
- func (l *GlogLogger) Fatal(ctx context.Context, format string, args ...interface{})
- func (l *GlogLogger) Info(ctx context.Context, format string, args ...interface{})
- func (l *GlogLogger) InfoEnabled() bool
- func (l *GlogLogger) Warn(ctx context.Context, format string, args ...interface{})
- func (l *GlogLogger) WarnEnabled() bool
- type GlogLoggerBuilder
- func (b *GlogLoggerBuilder) Build() (logger *GlogLogger, err error)
- func (b *GlogLoggerBuilder) DebugV(v glog.Level) *GlogLoggerBuilder
- func (b *GlogLoggerBuilder) ErrorV(v glog.Level) *GlogLoggerBuilder
- func (b *GlogLoggerBuilder) InfoV(v glog.Level) *GlogLoggerBuilder
- func (b *GlogLoggerBuilder) WarnV(v glog.Level) *GlogLoggerBuilder
- type GoLogger
- func (l *GoLogger) Debug(ctx context.Context, format string, args ...interface{})
- func (l *GoLogger) DebugEnabled() bool
- func (l *GoLogger) Error(ctx context.Context, format string, args ...interface{})
- func (l *GoLogger) ErrorEnabled() bool
- func (l *GoLogger) Fatal(ctx context.Context, format string, args ...interface{})
- func (l *GoLogger) Info(ctx context.Context, format string, args ...interface{})
- func (l *GoLogger) InfoEnabled() bool
- func (l *GoLogger) Warn(ctx context.Context, format string, args ...interface{})
- func (l *GoLogger) WarnEnabled() bool
- type GoLoggerBuilder
- func (b *GoLoggerBuilder) Build() (logger *GoLogger, err error)
- func (b *GoLoggerBuilder) Debug(flag bool) *GoLoggerBuilder
- func (b *GoLoggerBuilder) Error(flag bool) *GoLoggerBuilder
- func (b *GoLoggerBuilder) Info(flag bool) *GoLoggerBuilder
- func (b *GoLoggerBuilder) Warn(flag bool) *GoLoggerBuilder
- type Logger
- type StdLogger
- func (l *StdLogger) Debug(ctx context.Context, format string, args ...interface{})
- func (l *StdLogger) DebugEnabled() bool
- func (l *StdLogger) Error(ctx context.Context, format string, args ...interface{})
- func (l *StdLogger) ErrorEnabled() bool
- func (l *StdLogger) Fatal(ctx context.Context, format string, args ...interface{})
- func (l *StdLogger) Info(ctx context.Context, format string, args ...interface{})
- func (l *StdLogger) InfoEnabled() bool
- func (l *StdLogger) Warn(ctx context.Context, format string, args ...interface{})
- func (l *StdLogger) WarnEnabled() bool
- type StdLoggerBuilder
- func (b *StdLoggerBuilder) Build() (logger *StdLogger, err error)
- func (b *StdLoggerBuilder) Debug(flag bool) *StdLoggerBuilder
- func (b *StdLoggerBuilder) Error(flag bool) *StdLoggerBuilder
- func (b *StdLoggerBuilder) Info(flag bool) *StdLoggerBuilder
- func (b *StdLoggerBuilder) Streams(out io.Writer, err io.Writer) *StdLoggerBuilder
- func (b *StdLoggerBuilder) Warn(flag bool) *StdLoggerBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GlogLogger ¶
type GlogLogger struct {
// contains filtered or unexported fields
}
GlogLogger is a logger that uses the glog V mechanism.
func (*GlogLogger) Debug ¶
func (l *GlogLogger) Debug(ctx context.Context, format string, args ...interface{})
Debug sends to the log a debug message formatted using the fmt.Sprintf function and the given format and arguments.
func (*GlogLogger) DebugEnabled ¶
func (l *GlogLogger) DebugEnabled() bool
DebugEnabled returns true iff the debug level is enabled.
func (*GlogLogger) Error ¶
func (l *GlogLogger) Error(ctx context.Context, format string, args ...interface{})
Error sends to the log an error message formatted using the fmt.Sprintf function and the given format and arguments.
func (*GlogLogger) ErrorEnabled ¶
func (l *GlogLogger) ErrorEnabled() bool
ErrorEnabled returns true iff the error level is enabled.
func (*GlogLogger) Fatal ¶
func (l *GlogLogger) Fatal(ctx context.Context, format string, args ...interface{})
Fatal sends to the log an error message formatted using the fmt.Sprintf function and the given format and arguments. After that it will os.Exit(1) This level is always enabled
func (*GlogLogger) Info ¶
func (l *GlogLogger) Info(ctx context.Context, format string, args ...interface{})
Info sends to the log an information message formatted using the fmt.Sprintf function and the given format and arguments.
func (*GlogLogger) InfoEnabled ¶
func (l *GlogLogger) InfoEnabled() bool
InfoEnabled returns true iff the information level is enabled.
func (*GlogLogger) Warn ¶
func (l *GlogLogger) Warn(ctx context.Context, format string, args ...interface{})
Warn sends to the log a warning message formatted using the fmt.Sprintf function and the given format and arguments.
func (*GlogLogger) WarnEnabled ¶
func (l *GlogLogger) WarnEnabled() bool
WarnEnabled returns true iff the warning level is enabled.
type GlogLoggerBuilder ¶
type GlogLoggerBuilder struct {
// contains filtered or unexported fields
}
GlogLoggerBuilder contains the configuration and logic needed to build a logger that uses the glog V mechanism. Don't create instances of this type directly, use the NewGlogLoggerBuilder function instead.
func NewGlogLoggerBuilder ¶
func NewGlogLoggerBuilder() *GlogLoggerBuilder
NewGlogLoggerBuilder creates a builder that uses the glog V mechanism. By default errors, warnings and information messages will be written to the log if the level is 0 or greater, and debug messages will be written if the level is 1 or greater. This can be changed using the ErrorV, WarnV, InfoV and DebugV methods of the builder. For example, to write errors and warnings for level 0, information messages for level 1, and debug messages for level 2, you can create the logger like this:
logger, err := client.NewGlobLoggerBuilder(). ErrorV(0). WarnV(0). InfoV(1). DebugV(2). Build()
Once the logger is created these settings can't be changed.
func (*GlogLoggerBuilder) Build ¶
func (b *GlogLoggerBuilder) Build() (logger *GlogLogger, err error)
Build creates a new logger using the configuration stored in the builder.
func (*GlogLoggerBuilder) DebugV ¶
func (b *GlogLoggerBuilder) DebugV(v glog.Level) *GlogLoggerBuilder
DebugV sets the V value that will be used for debug messages.
func (*GlogLoggerBuilder) ErrorV ¶
func (b *GlogLoggerBuilder) ErrorV(v glog.Level) *GlogLoggerBuilder
ErrorV sets the V value that will be used for error messages.
func (*GlogLoggerBuilder) InfoV ¶
func (b *GlogLoggerBuilder) InfoV(v glog.Level) *GlogLoggerBuilder
InfoV sets the V value that will be used for info messages.
func (*GlogLoggerBuilder) WarnV ¶
func (b *GlogLoggerBuilder) WarnV(v glog.Level) *GlogLoggerBuilder
WarnV sets the V value that will be used for warn messages.
type GoLogger ¶
type GoLogger struct {
// contains filtered or unexported fields
}
GoLogger is a logger that uses the Go `log` package.
func (*GoLogger) Debug ¶
Debug sends to the log a debug message formatted using the fmt.Sprintf function and the given format and arguments.
func (*GoLogger) DebugEnabled ¶
DebugEnabled returns true iff the debug level is enabled.
func (*GoLogger) Error ¶
Error sends to the log an error message formatted using the fmt.Sprintf function and the given format and arguments.
func (*GoLogger) ErrorEnabled ¶
ErrorEnabled returns true iff the error level is enabled.
func (*GoLogger) Fatal ¶
Fatal sends to the log an error message formatted using the fmt.Sprintf function and the given format and arguments. After that it will os.Exit(1) This level is always enabled
func (*GoLogger) Info ¶
Info sends to the log an information message formatted using the fmt.Sprintf function and the given format and arguments.
func (*GoLogger) InfoEnabled ¶
InfoEnabled returns true iff the information level is enabled.
func (*GoLogger) Warn ¶
Warn sends to the log a warning message formatted using the fmt.Sprintf function and the given format and arguments.
func (*GoLogger) WarnEnabled ¶
WarnEnabled returns true iff the warning level is enabled.
type GoLoggerBuilder ¶
type GoLoggerBuilder struct {
// contains filtered or unexported fields
}
GoLoggerBuilder contains the configuration and logic needed to build a logger that uses the Go `log` package. Don't create instances of this type directly, use the NewGoLoggerBuilder function instead.
func NewGoLoggerBuilder ¶
func NewGoLoggerBuilder() *GoLoggerBuilder
NewGoLoggerBuilder creates a builder that knows how to build a logger that uses the Go `log` package. By default these loggers will have enabled the information, warning and error levels
func (*GoLoggerBuilder) Build ¶
func (b *GoLoggerBuilder) Build() (logger *GoLogger, err error)
Build creates a new logger using the configuration stored in the builder.
func (*GoLoggerBuilder) Debug ¶
func (b *GoLoggerBuilder) Debug(flag bool) *GoLoggerBuilder
Debug enables or disables the debug level.
func (*GoLoggerBuilder) Error ¶
func (b *GoLoggerBuilder) Error(flag bool) *GoLoggerBuilder
Error enables or disables the error level.
func (*GoLoggerBuilder) Info ¶
func (b *GoLoggerBuilder) Info(flag bool) *GoLoggerBuilder
Info enables or disables the information level.
func (*GoLoggerBuilder) Warn ¶
func (b *GoLoggerBuilder) Warn(flag bool) *GoLoggerBuilder
Warn enables or disables the warning level.
type Logger ¶
type Logger interface { // DebugEnabled returns true if the debug level is enabled. DebugEnabled() bool // InfoEnabled returns true if the information level is enabled. InfoEnabled() bool // WarnEnabled returns true if the warning level is enabled. WarnEnabled() bool // ErrorEnabled returns true if the error level is enabled. ErrorEnabled() bool // Debug sends to the log a debug message formatted using the fmt.Sprintf function and the // given format and arguments. Debug(ctx context.Context, format string, args ...interface{}) // Info sends to the log an information message formatted using the fmt.Sprintf function and // the given format and arguments. Info(ctx context.Context, format string, args ...interface{}) // Warn sends to the log a warning message formatted using the fmt.Sprintf function and the // given format and arguments. Warn(ctx context.Context, format string, args ...interface{}) // Error sends to the log an error message formatted using the fmt.Sprintf function and the // given format and arguments. Error(ctx context.Context, format string, args ...interface{}) // Fatal sends to the log an error message formatted using the fmt.Sprintf function and the // given format and arguments; and then executes an os.Exit(1) // Fatal level is always enabled Fatal(ctx context.Context, format string, args ...interface{}) }
Logger is the interface that must be implemented by objects that are used for logging by the client. By default the client uses a logger based on the `glog` package, but that can be changed using the `Logger` method of the builder.
Note that the context is optional in most of the methods of the SDK, so implementations of this interface must accept and handle smoothly calls to the Debug, Info, Warn and Error methods where the ctx parameter is nil.
type StdLogger ¶
type StdLogger struct {
// contains filtered or unexported fields
}
StdLogger is a logger that uses the standard output and error streams, or custom writers.
func (*StdLogger) Debug ¶
Debug sends to the log a debug message formatted using the fmt.Sprintf function and the given format and arguments.
func (*StdLogger) DebugEnabled ¶
DebugEnabled returns true iff the debug level is enabled.
func (*StdLogger) Error ¶
Error sends to the log an error message formatted using the fmt.Sprintf function and the given format and arguments.
func (*StdLogger) ErrorEnabled ¶
ErrorEnabled returns true iff the error level is enabled.
func (*StdLogger) Fatal ¶
Fatal sends to the log an error message formatted using the fmt.Sprintf function and the given format and arguments. After that it will os.Exit(1) This level is always enabled
func (*StdLogger) Info ¶
Info sends to the log an information message formatted using the fmt.Sprintf function and the given format and arguments.
func (*StdLogger) InfoEnabled ¶
InfoEnabled returns true iff the information level is enabled.
func (*StdLogger) Warn ¶
Warn sends to the log a warning message formatted using the fmt.Sprintf function and the given format and arguments.
func (*StdLogger) WarnEnabled ¶
WarnEnabled returns true iff the warning level is enabled.
type StdLoggerBuilder ¶
type StdLoggerBuilder struct {
// contains filtered or unexported fields
}
StdLoggerBuilder contains the configuration and logic needed to build a logger that uses the standard output and error streams, or custom writers.
func NewStdLoggerBuilder ¶
func NewStdLoggerBuilder() *StdLoggerBuilder
NewStdLoggerBuilder creates a builder that knows how to build a logger that uses the standard output and error streams, or custom writers. By default these loggers will have enabled the information, warning and error levels
func (*StdLoggerBuilder) Build ¶
func (b *StdLoggerBuilder) Build() (logger *StdLogger, err error)
Build creates a new logger using the configuration stored in the builder.
func (*StdLoggerBuilder) Debug ¶
func (b *StdLoggerBuilder) Debug(flag bool) *StdLoggerBuilder
Debug enables or disables the debug level.
func (*StdLoggerBuilder) Error ¶
func (b *StdLoggerBuilder) Error(flag bool) *StdLoggerBuilder
Error enables or disables the error level.
func (*StdLoggerBuilder) Info ¶
func (b *StdLoggerBuilder) Info(flag bool) *StdLoggerBuilder
Info enables or disables the information level.
func (*StdLoggerBuilder) Streams ¶
func (b *StdLoggerBuilder) Streams(out io.Writer, err io.Writer) *StdLoggerBuilder
Streams sets the standard output and error streams to use. If not used then the logger will use os.Stdout and os.Stderr.
func (*StdLoggerBuilder) Warn ¶
func (b *StdLoggerBuilder) Warn(flag bool) *StdLoggerBuilder
Warn enables or disables the warning level.