DEV.co
Open-Source Observability · lmittmann

tint

tint is a lightweight Go logging handler that adds colored output to the standard library's slog package. It requires zero external dependencies and works as a drop-in replacement for slog.TextHandler, making it simple to integrate into existing Go applications for better log readability in terminals.

Source: GitHub — github.com/lmittmann/tint
1.3k
GitHub stars
63
Forks
Go
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositorylmittmann/tint
Ownerlmittmann
Primary languageGo
LicenseMIT — OSI-approved
Stars1.3k
Forks63
Open issues1
Latest releasev1.1.3 (2026-02-02)
Last updated2026-02-11
Sourcehttps://github.com/lmittmann/tint

What tint is

tint implements a zero-dependency slog.Handler that outputs ANSI-colorized logs with customizable formatting via Options (compatible with slog.HandlerOptions). It supports attribute replacement, custom log levels, and conditional color output detection, with Windows color support available through optional integrations like go-colorable.

Quickstart

Get the tint source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/lmittmann/tint.gitcd tint# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Local Development & Debugging

Enhanced log readability during development with color-coded log levels, timestamps, and attributes. Improves developer experience when debugging applications locally.

CLI Applications & Tools

Ideal for command-line tools and utilities where terminal output is primary. Small dependency footprint keeps CLI binaries lean while improving user-visible logging quality.

Containerized Applications with TTY Output

Suitable for containerized services that output logs to stdout/stderr in development or staging where ANSI color output is consumed by terminals or log aggregators that support color.

Implementation considerations

  • Choose output destination carefully: os.Stderr is conventional for logs; ensure it matches your application's logging infrastructure.
  • Use NoColor flag or go-isatty integration to detect terminal capabilities and avoid writing ANSI codes to log files or non-interactive streams.
  • Implement ReplaceAttr callbacks early if you need custom log levels (e.g., TRACE), error highlighting, or attribute filtering—this is the primary customization hook.
  • Consider Windows compatibility upfront: wrap stderr with go-colorable if cross-platform color support is required.
  • Test color output in your target terminal/environment (local dev, CI logs, container stdout) to ensure readability and prevent ANSI code visibility.

When to avoid it — and what to weigh

  • Structured Logging to Log Aggregators — If you need JSON or other machine-parseable structured logs for centralized logging systems (Datadog, ELK, CloudWatch), tint's colorized text output is not suitable. Use slog.JSONHandler instead.
  • Non-Interactive / Batch Processing — For applications that write logs to files, pipes, or non-terminal destinations, ANSI color codes add noise. NoColor option exists but defeats the purpose; consider standard slog.TextHandler.
  • Production Server Logging — Production systems typically require structured, machine-parseable logs. Colorized output is not standard practice and complicates log ingestion, filtering, and compliance auditing.
  • Windows Without Additional Packages — Native Windows console does not support ANSI color codes by default. Requires go-colorable package to function properly on Windows, adding a dependency for cross-platform use.

License & commercial use

Licensed under MIT (MIT License), a permissive OSI-approved license. Allows commercial use, modification, and distribution with minimal restrictions.

MIT license permits unrestricted commercial use, including in proprietary software. No attribution required, though attribution is appreciated. Suitable for production commercial applications. Review MIT terms for any edge-case compliance requirements in your jurisdiction.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

No known security issues. tint operates purely on output formatting; no network calls, file system access beyond writing to provided io.Writer, or external dependencies. Input validation is minimal (treats slog.Attr as trusted). Consider: ANSI color codes in user-supplied log values could theoretically manipulate terminal state (rare but possible); review ReplaceAttr logic if logging untrusted input.

Alternatives to consider

slog.TextHandler (stdlib)

Built into Go standard library, no color, suitable if plain text logs are acceptable and color is not needed.

slog.JSONHandler (stdlib)

Structured JSON output for production log aggregators; use if centralized logging (Datadog, ELK) is required instead of terminal readability.

zerolog with ConsoleWriter

Mature structured logging package with colored console output; heavier dependency but broader feature set (performance, sampling, levels) for complex logging needs.

Software development agency

Build on tint with DEV.co software developers

Integrate tint into your project today for better log readability during development. Evaluate fit with our technical team for your specific use case.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

tint FAQ

Does tint support structured logging for log aggregators?
No. tint outputs colorized plain text optimized for terminal readability. For centralized logging (Datadog, ELK, CloudWatch), use slog.JSONHandler or a structured logging package like zerolog.
How do I detect if colors should be enabled automatically?
Use the go-isatty package to check if the output destination is a TTY: `NoColor: !isatty.IsTerminal(w.Fd())`. This prevents ANSI codes in piped or file output.
Does tint work on Windows?
By default, Windows console does not render ANSI color codes. Wrap stderr with go-colorable (`colorable.NewColorable(os.Stderr)`) to enable color support on Windows.
Can I use tint in production?
tint is suitable for production use in terms of stability and licensing (MIT). However, production systems typically log to files or aggregators, not colored terminals. Use tint for development/debugging; switch to slog.JSONHandler for production log pipelines.

Custom software development services

DEV.co helps companies turn open-source tools like tint into production software. Our software development services cover the full lifecycle — architecture, web development, integration, and maintenance — delivered by software developers and web developers who ship. Engage our software development agency to implement or customize it for your open-source observability stack.

Ready to enhance your Go logging?

Integrate tint into your project today for better log readability during development. Evaluate fit with our technical team for your specific use case.