log
API
log
packageAPI reference for the log
package.
T
type
LogLevel
LogLevel represents the severity of a log message.
pkg/log/log.go:10-10
type LogLevel int
I
interface
Logger
Logger defines the interface for logging messages with different severity levels.
pkg/log/log.go:20-25
type Logger interface
S
wrappedLogger
pkg/log/log.go:27-29
type wrappedLogger struct
Methods
Info
Method
Parameters
format
string
a
...any
func (*wrappedLogger) Info(format string, a ...any)
{
l.inner.Info(fmt.Sprintf(format, a...))
}
Success
Method
Parameters
format
string
a
...any
func (*wrappedLogger) Success(format string, a ...any)
{
l.inner.Info(fmt.Sprintf(format, a...))
}
Warning
Method
Parameters
format
string
a
...any
func (*wrappedLogger) Warning(format string, a ...any)
{
l.inner.Warn(fmt.Sprintf(format, a...))
}
Error
Method
Parameters
format
string
a
...any
func (*wrappedLogger) Error(format string, a ...any)
{
l.inner.Error(fmt.Sprintf(format, a...))
}
Fields
| Name | Type | Description |
|---|---|---|
| inner | flogger.Logger |
F
function
New
New creates a new instance of the Logger, backed by go-foundation’s structured logger.
Returns
pkg/log/log.go:37-39
func New() Logger
{
return &wrappedLogger{inner: flogger.New()}
}
Example
logger := log.New()
logger.Info("Starting application...")
Uses
F
function
NewFoundationLogger
NewFoundationLogger returns the underlying go-foundation structured logger,
useful for advanced use cases like adding sinks or structured fields.
Returns
pkg/log/log.go:64-66
func NewFoundationLogger() flogger.Logger
{
return flogger.New()
}
Example
fl := log.NewFoundationLogger()
fl.Info("structured message", logger.Field{Key: "user", Value: "alice"})