How crazyokd/lol works
Project type and purpose
• From the README and file tree, this is a small C‐based logging library (“LOL”) plus example and test executables. It exposes a clean C API (lol_init*, lol_xxx, lol_add_domain, etc.) for emitting log messages at various severity levels, routing them to one or more sinks (console, file). Build is driven by a Makefile or Meson.
File structure
• Top level:
• lol.c, lol.h ← core library implementation & header
• example.c ← example client that links against the library
• test.c, test2.c ← test clients
• format.sh ← wrapper to invoke Meson formatting targets
• Makefile, meson.build ← two build‐system entry points
• README.md ← project description & usage
• No separate src/ or include/ directories—everything is at project root.
• Build outputs (not shown) will be binaries (lol-example, test, etc.) and installable library.
README for additional insights
• Usage shows two init styles (lol_init vs. lol_init2), domain support, three API families (xxx, xxx2, xxx3) optimized in steps, and a final lol_fini.
• TODO calls out log‐file support (done) and write‐call optimization.
• There is no external service dependency apart from the C standard library (libc_write).
a. Main components:
• Clients: example.c, test.c/test2.c
• Logging Library: lol.c/h
– Initialization & teardown
– Domain manager
– Severity filter
– Sink manager (console sink, file sink)
• Build System: Makefile & Meson scripts
• Outputs: stdout/stderr console, log file on disk
• External dependency: OS filesystems & libc write()
b. Relationships and interactions:
1. Client code calls logging API →
2. Library routes message through domain & level filters →
3. Sink manager fans out to console and/or file sink →
4. Sink invokes libc write() → OS writes to terminal or log file
5. Build system compiles client + library into executables
c. Architectural patterns & design principles:
• Modular layering: API surface layer → core engine → sink implementations
• Domain-based filtering: pluggable domains with independent severity thresholds
• Pluggable sinks: can be extended with new output backends
• Separation of build from source: support for both Makefile and Meson
d. Key technologies & libraries:
• Pure C99 code, no external dependencies beyond libc
• Meson (meson.build) and Make (Makefile) for building, muon-fmt for formatting
Detail without over‐splitting
• Data/control flow: initialization, logging call path, and teardown.
• Build step distinctly to show how the library and clients get assembled.