MillerByte Logging

Session-scoped API logging with Wide Events

Track user journeys, capture complete request context, and gain deep insights into your application

Why Traditional API Logging Falls Short

Traditional API logging scatters information across multiple log lines, making it difficult to understand what happened during a request. You end up with dozens of log statements per endpoint, and when something goes wrong, you're left piecing together fragments from different sources.

Traditional Approach

Scattered logs throughout your API:

// Traditional approach - scattered logs
_logger.LogInformation("Request started: {Method} {Path}", method, path);
_logger.LogInformation("User authenticated: {UserId}", userId);
_logger.LogInformation("Fetching user data");
_logger.LogInformation("Processing business logic");
_logger.LogInformation("Request completed with status {Status}", statusCode);

Wide API Events

Capture everything in one structured event:

[ApiLogging]
public async Task<IActionResult> GetUser(int id)
{
	var user = await _userRepository.GetByIdAsync(id);
	return Ok(user);
}

This creates a single MongoDB document containing the complete request context: endpoint info, user identity, request/response bodies, timing data, trace IDs, and any custom log messages you add during processing.

Key Benefits

Session-Scoped Logging

Track user journeys across multiple requests by automatically maintaining session context.

Wide API Events

Capture complete request/response information in a single structured document with full context.

Built for Production

Resilient background processing with circuit breakers, retry policies, and fallback logging.

GDPR by Default

Export and delete user data with streaming APIs designed for compliance requirements.

Inspiration: This approach is inspired by "Logging Sucks" by Boris Tane, which advocates for capturing complete context in wide events rather than scattering information across multiple narrow log lines.

Choose Your Package

Select the package that fits your stack

Looking for something specific?