Skip to main content

SyntropyLog Examples

The source of truth for the example list is the syntropylog-examples repository (see its README). All runnable examples use the current API: syntropyLog.init({ logger, context }), getLogger(), getContextManager(), no getHttp/getBroker/getRedis in core.

Examples 00–17 (syntropylog-examples)

#FolderWhat it shows
Fundamentals
0000-setup-initializationInit (ready/error), getLogger, shutdown
0101-hello-worldFirst log
02–0902-basic-context09-All-transportsContext, levels, transports, logging matrix
Integration
10–1110-basic-http-correlation, 11-axios-interceptorsHTTP correlation via Axios interceptors
1212-UniversalAdapterUniversalAdapter / custom backends
Testing
13–1613-testing-patterns16-testing-transports-conceptsVitest, Jest, serializers, transport concepts
Benchmark
1717-benchmarkSyntropyLog vs Pino vs Winston

Run any example from its folder: npm install then npm run dev (or the script in that example’s README).

Testing guides (this site)

Supplementary guides that align with repo examples 13–16:

Principles

  • Configure onceinit() with logger and context; use getLogger() and getContextManager() after ready.
  • HTTP — Use your own client (e.g. Axios) and inject correlation via interceptors; see repo examples 10–11.
  • Testing — Use syntropylog/testing (createTestHelper, SpyTransport); runnable tests in repo 13–16.