Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToContext ¶
ToContext adds a logger to the context that can be retrieved later. The logger will be used for operations performed with this context. If no logger is provided in the context, a no-op logger will be used.
Parameters:
- ctx: The context to add the logger to
- logger: The logger to store in the context
Returns:
- context.Context: A new context with the logger stored
Types ¶
type Logger ¶
type Logger interface { Debug(msg string, keysAndValues ...any) Info(msg string, keysAndValues ...any) Error(msg string, keysAndValues ...any) Warn(msg string, keysAndValues ...any) }
Logger is a minimal logging interface for nanogit clients.
func FromContext ¶
FromContext retrieves the logger from the context. If no logger is stored in the context, nil will be returned.
Parameters:
- ctx: The context to retrieve the logger from
Returns:
- Logger: The logger stored in the context, or nil if none is found
type NoopLogger ¶
type NoopLogger struct{}
noopLogger implements Logger but does nothing.
func (*NoopLogger) Debug ¶
func (n *NoopLogger) Debug(msg string, keysAndValues ...any)
func (*NoopLogger) Error ¶
func (n *NoopLogger) Error(msg string, keysAndValues ...any)
func (*NoopLogger) Info ¶
func (n *NoopLogger) Info(msg string, keysAndValues ...any)
func (*NoopLogger) Warn ¶
func (n *NoopLogger) Warn(msg string, keysAndValues ...any)
Click to show internal directories.
Click to hide internal directories.