Documentation ¶
Index ¶
- Constants
- func ReopenOnSignal(logger *Logger, reopener Reopener) func(context.Context) error
- type HCLogAdapter
- func (a *HCLogAdapter) CreateEntry(args []interface{}) *logrus.Entry
- func (a *HCLogAdapter) Debug(msg string, args ...interface{})
- func (a *HCLogAdapter) Error(msg string, args ...interface{})
- func (a *HCLogAdapter) ImpliedArgs() []interface{}
- func (a *HCLogAdapter) Info(msg string, args ...interface{})
- func (a *HCLogAdapter) IsDebug() bool
- func (a *HCLogAdapter) IsError() bool
- func (a *HCLogAdapter) IsInfo() bool
- func (a *HCLogAdapter) IsTrace() bool
- func (a *HCLogAdapter) IsWarn() bool
- func (a *HCLogAdapter) Log(level hclog.Level, msg string, args ...interface{})
- func (a *HCLogAdapter) Name() string
- func (a *HCLogAdapter) Named(name string) hclog.Logger
- func (a *HCLogAdapter) ResetNamed(name string) hclog.Logger
- func (a *HCLogAdapter) SetLevel(hclog.Level)
- func (a *HCLogAdapter) StandardLogger(opts *hclog.StandardLoggerOptions) *log.Logger
- func (a *HCLogAdapter) StandardWriter(opts *hclog.StandardLoggerOptions) io.Writer
- func (*HCLogAdapter) Trace(_ string, _ ...interface{})
- func (a *HCLogAdapter) Warn(msg string, args ...interface{})
- func (a *HCLogAdapter) With(args ...interface{}) hclog.Logger
- type Logger
- type Option
- type ReopenableFile
- type ReopenableWriteCloser
- type Reopener
Constants ¶
const ( DefaultFormat = "" JSONFormat = "JSON" TextFormat = "TEXT" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HCLogAdapter ¶
type HCLogAdapter struct {
// contains filtered or unexported fields
}
HCLogAdapter implements the hclog interface, and wraps it around a Logrus entry
func NewHCLogAdapter ¶ added in v0.11.0
func NewHCLogAdapter(log logrus.FieldLogger, name string) *HCLogAdapter
func (*HCLogAdapter) CreateEntry ¶
func (a *HCLogAdapter) CreateEntry(args []interface{}) *logrus.Entry
func (*HCLogAdapter) Debug ¶
func (a *HCLogAdapter) Debug(msg string, args ...interface{})
func (*HCLogAdapter) Error ¶
func (a *HCLogAdapter) Error(msg string, args ...interface{})
func (*HCLogAdapter) ImpliedArgs ¶ added in v0.11.0
func (a *HCLogAdapter) ImpliedArgs() []interface{}
ImpliedArgs returns With key/value pairs
func (*HCLogAdapter) Info ¶
func (a *HCLogAdapter) Info(msg string, args ...interface{})
func (*HCLogAdapter) IsDebug ¶
func (a *HCLogAdapter) IsDebug() bool
func (*HCLogAdapter) IsError ¶
func (a *HCLogAdapter) IsError() bool
func (*HCLogAdapter) IsInfo ¶
func (a *HCLogAdapter) IsInfo() bool
func (*HCLogAdapter) IsTrace ¶
func (a *HCLogAdapter) IsTrace() bool
func (*HCLogAdapter) IsWarn ¶
func (a *HCLogAdapter) IsWarn() bool
func (*HCLogAdapter) Log ¶
func (a *HCLogAdapter) Log(level hclog.Level, msg string, args ...interface{})
func (*HCLogAdapter) Name ¶
func (a *HCLogAdapter) Name() string
func (*HCLogAdapter) Named ¶
func (a *HCLogAdapter) Named(name string) hclog.Logger
func (*HCLogAdapter) ResetNamed ¶
func (a *HCLogAdapter) ResetNamed(name string) hclog.Logger
func (*HCLogAdapter) SetLevel ¶
func (a *HCLogAdapter) SetLevel(hclog.Level)
func (*HCLogAdapter) StandardLogger ¶
func (a *HCLogAdapter) StandardLogger(opts *hclog.StandardLoggerOptions) *log.Logger
StandardLogger is meant to return a stdlib Logger type which wraps around hclog. It does this by providing an io.Writer and instantiating a new Logger. It then tries to interpret the log level by parsing the message.
Since we are not using `hclog` in a generic way, and I cannot find any calls to this method from go-plugin, we will poorly support this method. Rather than pull in all of hclog writer parsing logic, pass it a Logrus writer, and hardcode the level to INFO.
Apologies to those who find themselves here.
func (*HCLogAdapter) StandardWriter ¶
func (a *HCLogAdapter) StandardWriter(opts *hclog.StandardLoggerOptions) io.Writer
func (*HCLogAdapter) Trace ¶
func (*HCLogAdapter) Trace(_ string, _ ...interface{})
HCLog has one more level than we do. As such, we will never set trace level.
func (*HCLogAdapter) Warn ¶
func (a *HCLogAdapter) Warn(msg string, args ...interface{})
func (*HCLogAdapter) With ¶
func (a *HCLogAdapter) With(args ...interface{}) hclog.Logger
type Option ¶
An Option can change the Logger to apply desired configuration in NewLogger
func WithFormat ¶
func WithOutputFile ¶
WithOutputFile requires lossy copytruncate directive in logrotate.
func WithReopenableOutputFile ¶ added in v1.2.2
func WithReopenableOutputFile(reopenableFile *ReopenableFile) Option
WithReopenableOutputFile uses ReopenableFile to support handling a signal to rotate log files (e.g. from a logrotate postrotate script).
type ReopenableFile ¶ added in v1.2.2
type ReopenableFile struct {
// contains filtered or unexported fields
}
func NewReopenableFile ¶ added in v1.2.2
func NewReopenableFile(name string) (*ReopenableFile, error)
func (*ReopenableFile) Close ¶ added in v1.2.2
func (r *ReopenableFile) Close() error
func (*ReopenableFile) Name ¶ added in v1.2.2
func (r *ReopenableFile) Name() string
Name implements part of os.FileInfo without needing a lock on the underlying file.
func (*ReopenableFile) Reopen ¶ added in v1.2.2
func (r *ReopenableFile) Reopen() error
type ReopenableWriteCloser ¶ added in v1.2.2
type ReopenableWriteCloser interface { Reopener io.WriteCloser }
type Reopener ¶ added in v1.2.2
type Reopener interface {
Reopen() error
}
Reopener inspired by https://github.com/client9/reopen