Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger interface {
// Name returns the fully qualified name of the logger.
Name() string
Debug(args ...any)
Info(args ...any)
Warn(args ...any)
Error(args ...any)
Panic(args ...any)
// Fatal logs and then calls os.Exit(1)
// Be careful about using this since it does NOT unwind the stack and may exit uncleanly
Fatal(args ...any)
Debugf(format string, values ...any)
Infof(format string, values ...any)
Warnf(format string, values ...any)
Errorf(format string, values ...any)
Panicf(format string, values ...any)
Fatalf(format string, values ...any)
Debugw(msg string, keysAndValues ...any)
Infow(msg string, keysAndValues ...any)
Warnw(msg string, keysAndValues ...any)
Errorw(msg string, keysAndValues ...any)
Panicw(msg string, keysAndValues ...any)
Fatalw(msg string, keysAndValues ...any)
// Sync flushes any buffered log entries.
// Some insignificant errors are suppressed.
Sync() error
}
Logger is a basic logging interface implemented by smartcontractkit/chainlink/core/logger.Logger and go.uber.org/zap.SugaredLogger
Loggers should be injected (and usually Named as well): e.g. lggr.Named("<service name>")
Tests
- Tests should use a Test logger, with New being reserved for actual runtime and limited direct testing.
Levels
- Fatal: Logs and then calls os.Exit(1). Be careful about using this since it does NOT unwind the stack and may exit uncleanly.
- Panic: Unrecoverable error. Example: invariant violation, programmer error
- Error: Something bad happened, and it was clearly on the node op side. No need for immediate action though. Example: database write timed out
- Warn: Something bad happened, not clear who/what is at fault. Node ops should have a rough look at these once in a while to see whether anything stands out. Example: connection to peer was closed unexpectedly. observation timed out.
- Info: High level information. First level we’d expect node ops to look at. Example: entered new epoch with leader, made an observation with value, etc.
- Debug: Useful for forensic debugging, but we don't expect nops to look at this. Example: Got a message, dropped a message, ...
Node Operator Docs: https://docs.chain.link/docs/configuration-variables/#log_level This is a copy of the Logger interface from chainlink-common so we don't have to import the entire module in this repo.
func NewWith ¶
NewWith returns a new Logger from a modified zap.Config.
func TestObserved ¶
TestObserved returns a new test Logger for tb and ObservedLogs at the given Level.
Click to show internal directories.
Click to hide internal directories.