inline_logger library
A powerful inline logger for Flutter that lets you log anywhere in your widget tree without breakpoints. Chain logging calls directly on any expression.
Key Features:
- 🔗 Chainable logging - Log any value inline without breaking your code flow
- 🎯 Multiple log levels - Debug, Verbose, Info, Success, Warning, Error, Critical
- 🎨 Emoji support - Visual log levels with optional emoji indicators
- ⚡ Zero performance impact - Automatically disabled in release mode
- 📊 Log history - Store important logs for crash reporting
- 🔍 Stack trace support - Capture stack traces for errors
- 📍 Clickable source locations - IDE-clickable links to the exact call site in your code
- 🔌 Extensibility hooks - Custom formatters and record sinks
Quick Start
import 'package:inline_logger/inline_logger.dart';
// Log anywhere in your widget tree
Text(userData.log('User data').name)
// Chain multiple logs
final result = apiCall()
.log('API Response')
.data
.logSuccess('Data extracted');
// Use direct logging methods
Logger.error('Something went wrong', 'Error context');
Logger.apiRequest(endpoint: '/users', method: 'GET');
Classes
- AnsiColors
- ANSI color codes for terminal output.
- ConsoleFormatter
- Formats LogRecord instances into console-printable strings.
- Logger
- Main logger class with static methods.
- LoggerConfig
- Global configuration for the inline logger.
- LogRecord
- A structured record of a log event.
- SourceLocation
- Represents a source code location captured from a stack trace.
- SourceLocationResolver
-
Resolves source locations from stack traces by finding the first
frame outside
package:inline_logger/.
Enums
- ColorScope
- How much of the line the level's ANSI colour covers.
- KeyPlacement
-
Where the log's
key(subsystem tag) is rendered. - LevelStyle
- How the severity level is rendered.
- LinkFormat
- Defines how source location links are formatted in console output.
- LocationPlacement
-
Where the IDE-clickable
(<uri>:<line>:<column>)segment is placed. - LogLevel
- Log levels for categorizing log messages.
- TimestampStyle
- How the timestamp is rendered.
Extensions
- InlineLogger on E
- Extension on any type to enable inline logging.