Stop Fighting logrus Configuration: Meet logrus-configurator

Alright, let me tell you about something that’ll save your ass when you’re knee-deep in Go code and your logrus setup looks like it was configured by a drunk intern at 3 AM.

The Problem: Configuring logrus Is Usually Shit

You know what pisses me off? Spending 30 minutes configuring logrus when I could be writing actual code. Sure, logrus is a solid logging library, but setting it up properly makes you jump through hoops like a circus animal just to get basic shit working. Environment variables? Caller information? JSON formatting? Forget about it – you’re gonna need a PhD in configuration management just to get logrus behaving.

Fuck that noise.

Enter logrus-configurator: Zero-Config logrus Setup

I built logrus-configurator because I was tired of copy-pasting the same logrus setup code across every Go project. This package takes the already solid logrus library and gives it a brain so it can configure itself like a civilized human being.

Want proof? Here’s literally all you need:

package main
import (
    _ "github.com/psyb0t/logrus-configurator"
    "github.com/sirupsen/logrus"
)
func main() {
    logrus.Info("Holy shit, it just works")
}

That’s it. No bullshit initialization. No configuration structs. Just import and go.

The Magic Behind the Scenes

This thing is smart enough to configure itself based on environment variables:

  • LOG_LEVEL: Set your verbosity (trace, debug, info, warn, error, fatal, panic)
  • LOG_FORMAT: Choose between json or text
  • LOG_CALLER: Show who called the logger (true/false)

Example session that’ll blow your mind:

export LOG_LEVEL="trace"
export LOG_FORMAT="text"
export LOG_CALLER="true"
go run main.go

Output:

time="2025-09-07T10:56:28Z" level=trace msg="this shit's a trace" func="main.main()" file="main.go:9"
time="2025-09-07T10:56:28Z" level=debug msg="this shit's a debug" func="main.main()" file="main.go:10"

Want JSON instead? Switch LOG_FORMAT="json" and boom – structured logs ready for your ELK stack or whatever monitoring clusterfuck you’re running.

Advanced Features for When You Need More Control

Sometimes you need more than basic logging. Maybe you want to send errors to Slack, or dump metrics to a database. The hook management API has you covered:

import "github.com/psyb0t/logrus-configurator"
// Nuclear option - replace all hooks
logrusconfigurator.SetHooks(myDbHook, mySlackHook, myCustomHook)
// Gentle approach - add one hook without breaking shit
logrusconfigurator.AddHook(myMetricsHook)

Perfect for building complex logging pipelines without losing your sanity.

Quality That Doesn’t Compromise

This package has 96.3% test coverage because I don’t fuck around with reliability. Every edge case, every configuration option, every possible way you can break it – it’s all tested.

The testing philosophy is simple: table-driven tests for consistency, proper assertions for debugging, and a 90% coverage minimum enforced in CI/CD. Because if you’re gonna build something, build it right.

Why This Matters in the Real World

I’ve used this across multiple production systems – from microservices handling thousands of requests per second to background workers processing data pipelines. It just works, scales without drama, and doesn’t add overhead to your application.

The automatic configuration means your dev, staging, and prod environments can have completely different logging setups just by changing environment variables. No code changes, no redeployments, no bullshit.

The Bottom Line

logrus-configurator solves a simple problem: making logrus configuration not suck. It’s MIT licensed, thoroughly tested, and battle-proven in production environments.

If you’re tired of spending time on logrus configuration instead of building features, give it a shot. Your future self will thank you when you’re debugging production issues at 2 AM and actually have useful logs to work with.

Check it out: github.com/psyb0t/logrus-configurator

Now go build something awesome. And make sure it fuckin’ logs properly.