Summary
Create a comprehensive guide for the 18 writer types in logger_system, documenting the decorator pattern composition, and providing recommended writer stack configurations for common use cases.
Parent Issue
Part of: [EPIC] docs: Address documentation gaps across all ecosystem systems (kcenon/common_system#325)
Background (Why)
logger_system has 18 writer types in include/kcenon/logger/writers/ that compose via the decorator pattern. While individual writers may be partially documented, there is no guide explaining:
- How writers compose (decorator stacking order)
- Which writers are base writers vs decorators
- Recommended combinations for common scenarios
- The full catalog of available writers
This is one of the most user-facing features of logger_system (4.34M msg/sec, 148ns latency) and the decorator composition is non-obvious.
Scope (What)
Create docs/WRITER_GUIDE.md covering:
1. Writer Architecture
- Base writer vs decorator writer pattern
base_writer → decorator_writer_base inheritance chain
- How decorators wrap base writers (stack visualization)
2. Complete Writer Catalog
Base Writers (Output Destinations)
| Writer |
Output |
Description |
console_writer |
stdout/stderr |
Terminal output with optional coloring |
file_writer |
File |
Single file output |
rotating_file_writer |
Files |
Size/time-based rotation |
network_writer |
Network |
Remote log server output |
otlp_writer |
OTLP endpoint |
OpenTelemetry protocol export |
Decorator Writers (Processing Pipeline)
| Writer |
Function |
Description |
async_writer |
Async |
Non-blocking write via queue |
batch_writer |
Batching |
Accumulate and flush in batches |
buffered_writer |
Buffering |
Memory buffer before flush |
filtered_writer |
Filtering |
Level/category-based filtering |
formatted_writer |
Formatting |
Message formatting/templating |
thread_safe_writer |
Thread safety |
Mutex-protected writes |
encrypted_writer |
Encryption |
Encrypt log content |
critical_writer |
Priority |
Immediate flush for critical logs |
composite_writer |
Fan-out |
Write to multiple destinations |
queued_writer_base |
Queuing |
Base for queue-based writers |
legacy_writer_adapter |
Compatibility |
Adapter for legacy writer interface |
3. Composition Patterns
[Application Code]
↓
[filtered_writer] ← Drop DEBUG in production
↓
[formatted_writer] ← Add timestamp, level, source
↓
[async_writer] ← Non-blocking
↓
[batch_writer] ← Accumulate 100 messages
↓
[composite_writer]
├→ [rotating_file_writer] ← Local files
└→ [network_writer] ← Remote server
4. Recommended Stacks
| Use Case |
Stack (inner → outer) |
Performance |
| Development |
console_writer → formatted → filtered |
Simple, fast |
| Production file |
rotating_file → buffered → async → formatted → filtered |
High throughput |
| Compliance |
file → encrypted → batch → formatted → thread_safe |
Secure, auditable |
| Distributed |
network → async → batch → formatted → filtered |
Remote collection |
| Multi-output |
composite(file + network) → async → formatted |
Fan-out |
5. Code Examples
- Development setup (3 lines)
- Production file logging
- Encrypted compliance logging
- Multi-destination setup
6. Performance Impact
- Throughput per decorator layer
- Latency added per decorator
- Memory usage per configuration
Acceptance Criteria
Summary
Create a comprehensive guide for the 18 writer types in logger_system, documenting the decorator pattern composition, and providing recommended writer stack configurations for common use cases.
Parent Issue
Part of: [EPIC] docs: Address documentation gaps across all ecosystem systems (kcenon/common_system#325)
Background (Why)
logger_system has 18 writer types in
include/kcenon/logger/writers/that compose via the decorator pattern. While individual writers may be partially documented, there is no guide explaining:This is one of the most user-facing features of logger_system (4.34M msg/sec, 148ns latency) and the decorator composition is non-obvious.
Scope (What)
Create
docs/WRITER_GUIDE.mdcovering:1. Writer Architecture
base_writer→decorator_writer_baseinheritance chain2. Complete Writer Catalog
Base Writers (Output Destinations)
console_writerfile_writerrotating_file_writernetwork_writerotlp_writerDecorator Writers (Processing Pipeline)
async_writerbatch_writerbuffered_writerfiltered_writerformatted_writerthread_safe_writerencrypted_writercritical_writercomposite_writerqueued_writer_baselegacy_writer_adapter3. Composition Patterns
4. Recommended Stacks
5. Code Examples
6. Performance Impact
Acceptance Criteria