Skip to content
pubscout

contextual

2.2.0, released 10 months ago by glenfordwilliams.com

A structured logging library with context, middleware, and multiple output channels.

$ flutter pub add contextual
Source repository

What it does

Provides hierarchical named loggers, flexible formatting (JSON, logfmt, colored), and supports custom drivers. Allows adding context, middleware, and asynchronous batching for efficient log processing.

AI-written summary of version 2.2.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need structured, multi‑channel logging in a Dart/Flutter app
  • You want context propagation and hierarchical loggers
  • You require custom formatting or middleware for logs

Skip it when

  • You only need simple console prints
  • You prefer a built‑in Flutter logger without extra configuration

Strengths

  • Rich context and hierarchical logger support
  • Multiple output drivers and per‑channel formatters
  • Middleware and async batching for performance

Weaknesses

  • Adds extra dependency and setup compared to basic print statements
  • May be overkill for tiny projects
  • Learning curve for configuration and channel management

Setup

Kind
Pure Dart
Effort
Medium
Code generation
No
Direct dependencies
6

Add the package to pubspec, then create a Logger and optionally configure channels/formatters; no native permissions required

import 'package:contextual/contextual.dart';

void main() {
  final logger = Logger(level: Level.info)..withContext({'app':'MyApp'});
  logger.info('Application started');
  logger.error('Something went wrong');
}

Alternatives

Packages that do the same job and could replace contextual.

Works with

Packages commonly used together with contextual: ones it builds on, ones built on it, and its own family.