Loguru is a Python logging library that provides a pre-instantiated global logger with minimal boilerplate. Its architecture centers on a singleton `logger` object (defined in `_logger.py`) that delegates to a `Core` managing levels, handlers, and activation state. The primary entry point is `logger.add()`, which registers sinks (streams, files, callables, coroutines, or standard logging handlers) with optional formatting, filtering, rotation, retention, compression, enqueueing, and async support. Log messages are generated via level methods (`trace`, `debug`, `info`, `warning`, `error`, `critical`, `exception`) and flow through a `Handler` class (`_handler.py`) that applies formatting (colorized via `_colorizer.py`), filtering (level, function, or callable), and dispatching to the underlying sink. External dependencies are minimal and optional: `colorama` for Windows ANSI support, `win32_setctime` for file creation times, `exceptiongroup` for Python <3.11, and `aiocontextvars` for Python <3.7. The library also offers advanced exception formatting (`_better_exceptions.py`) with variable diagnostics, backtrace display, and chained/grouped exception support. It is designed for both application and library use, with `disable()`/`enable()` per module and `LOGURU_*` environment variable configuration. The codebase demonstrates high craftsmanship with clean abstractions, thorough test coverage (including snapshot-based exception formatting tests), and compatibility across Python 3.5β3.14.
structlog is a production-caliber structured logging library for Python. It decouples log event construction from output formatting using a composable processor chain β each processor receives a mutable event dictionary (with keys like event, log_level, timestamp, and custom fields) and can filter, enrich, or render it. The library provides a proxy-based bound logger (structlog.get_logger()) that lazily assembles the final logger with frozen context, supporting immutable bind/unbind operations suitable for safe usage across async and threaded code. Two context management backends exist: structlog.contextvars (recommended) for modern async-safe context propagation, and structlog.threadlocal (deprecated) for legacy thread-local patterns. The architecture centers on three global configuration axes: processors (a list of callables), wrapper class (the bound logger implementation), and logger factory (which creates the underlying output target). Built-in processors include JSONRenderer, ConsoleRenderer (with colorful column-based output), KeyValueRenderer, TimeStamper, CallsiteParameterAdder, and ExceptionRenderer. Specialized integration modules connect to Python's standard library logging (structlog.stdlib) and Twisted (structlog.twisted), allowing structlog to serve as a dropβin replacement for existing logging configurations while adding structured capabilities like structured tracebacks and filterable log levels. Testing support is built in via structlog.testing, which provides a capture_logs() context manager and a CapturingLogger for asserting log output in unit tests without side effects.
Logrus is a structured logging library for Go, providing a flexible and performant alternative to the standard library logger. It offers a clean architecture based on three core interfaces: Logger (configuration and output), Entry (log event with fields), Formatter (output formatting), and Hook (level-based callbacks). The library supports multiple output formats (text/logfmt with optional ANSI colors, JSON), customizable field maps, caller reporting, and a buffer pool for reduced allocation overhead. It includes built-in hooks for syslog, slog (Go's standard logging API), and a test hook for capturing log entries in tests. The package-level exported logger provides a simple global API, while custom Logger instances allow independent configuration. External dependencies are minimal, relying only on the standard library and a small set of well-maintained packages (testify for testing, sys for terminal detection). The codebase is in maintenance mode, focusing on stability, performance, and interoperability with Go's log/slog ecosystem.
Oops is a Go library for structured error handling that serves as a drop-in replacement for the standard error type. It provides a fluent builder pattern to attach rich contextual information (error codes, domains, tags, key-value attributes, user/tenant data, HTTP request/response, timestamps, durations, hints, ownership) to errors, along with automatic stack trace capture and optional source code fragment extraction. The library implements the standard error interface, supports error wrapping and chaining, panic recovery, assertions, and integrates with major Go logging libraries (zap, zerolog, logrus, slog) via separate formatter packages. Its architecture centers on an immutable option chain (functional options) that defers stack frame symbolization to first read, minimizing allocation overhead for errors that are created but never inspected. Key entry points are the package-level functions (Wrap, Wrapf, New, Errorf, Join, Recover, Recoverf, Assert, Assertf) and the OopsErrorBuilder chainable methods. External dependencies are minimal: only github.com/oklog/ulid/v2, github.com/samber/lo, and go.opentelemetry.io/otel/trace for optional OpenTelemetry span context extraction. The codebase is well-tested, benchmarked, and follows Go best practices with comprehensive linting and security scanning.
This repository implements a Serilog sink for writing log events to Microsoft SQL Server and Azure SQL databases. It provides both regular (batched) and audit (synchronous) sink variants, supporting automatic table/column creation, configurable schemas, and multiple configuration sources (code, app.config, appsettings.json). The architecture emphasizes separation of concerns through platform abstractions for data access, dependency injection for testability, and strategy patterns for write operations (bulk copy vs. individual inserts). The sink processes log events via Serilib's pipeline, batching them for efficiency unless using the audit sink for critical events. Data is transformed into SQL-compatible values through specialized generators for standard columns (timestamp, level, etc.) and additional custom columns. The system handles type mapping, truncation, and formatting (XML for properties, JSON for log events) while supporting features like hierarchical property resolution, indexed columns, and clustered columnstore indexes for performance. Key strengths include a well-structured plugin architecture with clear extensibility points, comprehensive test coverage across multiple .NET frameworks, and proactive dependency management. The codebase demonstrates solid engineering practices through interface-based design, factory patterns for dependency resolution, and careful handling of edge cases like batch failures and transactional integrity. While supporting legacy configurations adds some complexity, the project maintains active development with recent updates addressing security, performance, and compatibility with newer SQL Client versions.
Uber-go/zap is a high-performance, structured logging library for Go. It provides two primary logger types: the zero-allocation, reflection-free Logger for hot-path usage and the ergonomic SugaredLogger for printf-style logging. The library emphasizes minimal allocations through object pooling, lazy field evaluation, and efficient encoders (JSON and console). It includes advanced features like sampling, dynamic level adjustment via AtomicLevel, hook systems for extensibility, and integration with testing, gRPC, and standard library. The architecture is modular, separating public API (zap), core implementation (zapcore), testing utilities (zaptest), and experimental features (exp).
Trice is an embedded logging and tracing toolchain consisting of a lightweight C instrumentation library for microcontrollers and a Go-based host CLI tool. The C library provides variadic macros that emit compact binary records (ID + values) instead of format strings, drastically reducing flash and bandwidth usage. The Go tool manages Trice IDs (insert, clean, bind), decodes incoming binary streams from targets over UART, RTT, TCP/UDP, or file, and displays formatted logs with timestamps, colors, and filtering. It supports multiple buffer strategies (stack, static, double, ring), framing protocols (COBS, TCOBS), optional XTEA encryption, and local logging on the target itself. The architecture is a classic host-target split: the target runs the C library, the host runs the Go CLI. The codebase is well-tested with a large matrix of CGO test configurations and CI pipelines for multiple STM32 example projects. It is actively maintained with frequent releases and a responsive issue tracker.