Skip to content

contra-tracer-contrib

Utility modules for contra-tracer.

Overview

This library provides commonly needed functionality when working with contra-tracer:

Module Description
Data.Tracer.Intercept Selective forwarding via partial mapping
Data.Tracer.LogFile File and stdout logging with buffering
Data.Tracer.ThreadSafe MVar-based thread-safe wrapper
Data.Tracer.Throttle Frequency-based event throttling
Data.Tracer.Timestamp Timestamped event wrapper
Data.Tracer.Timestamps ISO 8601 timestamp prepending
Data.Tracer.TraceWith Pattern synonym for tracer deconstruction

Quick Start

import Data.Tracer.Contrib

main :: IO ()
main = logTracer Nothing $ \tracer -> do
    safeTracer <- newThreadSafeTracer tracer
    let timestamped = addTimestampsTracer safeTracer
    traceWith timestamped "Hello, world!"

Output:

[2025-01-29 10:30:45.123456 UTC] Hello, world!

Installation

See Getting Started for installation instructions.

License

Apache-2.0