Documentation ¶
Index ¶
- func Critical(l Logger, args ...interface{})deprecated
- func Criticalf(l Logger, format string, values ...interface{})deprecated
- func Criticalw(l Logger, msg string, keysAndValues ...interface{})deprecated
- func NewOCRWrapper(l Logger, trace bool, saveError func(string)) ocrtypes.Logger
- func Trace(l Logger, args ...interface{})deprecated
- func Tracef(l Logger, format string, values ...interface{})deprecated
- func Tracew(l Logger, msg string, keysAndValues ...interface{})deprecated
- type Config
- type Logger
- func Helper(l Logger, skip int) Logger
- func Named(l Logger, n string) Logger
- func New() (Logger, error)
- func NewWith(cfgFn func(*zap.Config)) (Logger, error)
- func NewWithSync(w io.Writer) Logger
- func Nop() Logger
- func Test(tb testing.TB) Logger
- func TestObserved(tb testing.TB, lvl zapcore.Level) (Logger, *observer.ObservedLogs)
- func With(l Logger, keyvals ...interface{}) Logger
- type SugaredLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewOCRWrapper ¶
NewOCRWrapper returns a new ocrtypes.Logger backed by the given Logger. Note: trace logs are written at debug level, regardless of any build tags.
Types ¶
type Logger ¶
type Logger interface { Name() string Debug(args ...interface{}) Info(args ...interface{}) Warn(args ...interface{}) Error(args ...interface{}) Panic(args ...interface{}) Fatal(args ...interface{}) Debugf(format string, values ...interface{}) Infof(format string, values ...interface{}) Warnf(format string, values ...interface{}) Errorf(format string, values ...interface{}) Panicf(format string, values ...interface{}) Fatalf(format string, values ...interface{}) Debugw(msg string, keysAndValues ...interface{}) Infow(msg string, keysAndValues ...interface{}) Warnw(msg string, keysAndValues ...interface{}) Errorw(msg string, keysAndValues ...interface{}) Panicw(msg string, keysAndValues ...interface{}) Fatalw(msg string, keysAndValues ...interface{}) Sync() error }
Logger is a minimal subset of smartcontractkit/chainlink/core/logger.Logger implemented by go.uber.org/zap.SugaredLogger
func Helper ¶
Helper returns a logger with 'skip' levels of callers skipped, if 'l' has a method `Helper(int) L`, where L implements Logger, otherwise it returns l. See zap.AddCallerSkip
func Named ¶
Named returns a logger with name 'n', if 'l' has a method `Named(string) L`, where L implements Logger, otherwise it returns l.
func NewWith ¶
NewWith returns a new Logger from a modified zap.Config.
func NewWithSync ¶ added in v0.3.0
NewWithSync returns a new Logger with a given SyncWriter.
func TestObserved ¶
TestObserved returns a new test Logger for tb and ObservedLogs at the given Level.
type SugaredLogger ¶
type SugaredLogger interface { Logger // AssumptionViolation variants log at error level with the message prefix "AssumptionViolation: ". AssumptionViolation(args ...interface{}) AssumptionViolationf(format string, vals ...interface{}) AssumptionViolationw(msg string, keysAndVals ...interface{}) // ErrorIf logs the error if present. ErrorIf(err error, msg string) // ErrorIfFn calls fn() and logs any returned error along with msg. // Unlike ErrorIf, this can be deffered inline, since the function call is delayed: // // defer lggr.ErrorIfFn(resource.Close, "Failed to close resource") ErrorIfFn(fn func() error, msg string) // Critical emits critical level logs (a remapping of [zap.DPanicLevel]) or falls back to error level with a '[crit]' prefix. Critical(args ...interface{}) Criticalf(format string, vals ...interface{}) Criticalw(msg string, keysAndVals ...interface{}) // Trace emits logs only when built with the 'trace' tag. // // go test -tags trace ./foo -run TestBar Trace(args ...interface{}) Tracef(format string, vals ...interface{}) Tracew(msg string, keysAndVals ...interface{}) Named(string) SugaredLogger With(keyvals ...any) SugaredLogger Helper(skip int) SugaredLogger }
SugaredLogger extends the base Logger interface with syntactic sugar, similar to zap.SugaredLogger.
func Sugared ¶
func Sugared(l Logger) SugaredLogger
Sugared returns a new SugaredLogger wrapping the given Logger. Prefer to store the SugaredLogger for reuse, instead of recreating it as needed.
func TestObservedSugared ¶
func TestObservedSugared(tb testing.TB, lvl zapcore.Level) (SugaredLogger, *observer.ObservedLogs)
TestObservedSugared returns a new test SugaredLogger for tb and ObservedLogs at the given Level.
func TestSugared ¶
func TestSugared(tb testing.TB) SugaredLogger
TestSugared returns a new test SugaredLogger.