sirupsen/logrus

Logging
import "github.com/sirupsen/logrus"

Structured logger for Go, completely API compatible with the standard library logger.

Example

package main

import log "github.com/sirupsen/logrus"

func main() {
    log.WithFields(log.Fields{
        "user": "alice",
        "ip":   "192.168.1.1",
    }).Info("User logged in")
}

Key Types & Functions

WithFieldsFieldsSetLevelSetFormatterEntryLogger

About sirupsen/logrus

The sirupsen/logrus package (imported as github.com/sirupsen/logrus) belongs to the Logging category of Go packages. Structured logger for Go, completely API compatible with the standard library logger.

Go's standard library is one of the language's greatest strengths, providing production-ready implementations for networking, cryptography, encoding, I/O, and more. The sirupsen/logrus package follows Go's philosophy of simplicity and composability — small, focused packages that combine through interfaces like io.Reader and io.Writer.

When using sirupsen/logrus in production, follow Go best practices: handle errors explicitly, use context for cancellation and timeouts, prefer composition over inheritance, and write table-driven tests. The Go documentation at pkg.go.dev provides comprehensive API references and examples for every exported type and function.

Related Packages