GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Vanderhell/microlog: Structured logging for embedded systems in C99 with zero allocations, pluggable backends, and portable integration.

BranchesTags
Open more actions menu

Latest commit

 

History

20 Commits
20 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
cmake
cmake
 
 
docs
docs
 
 
include
include
 
 
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CMakeLists.txt
CMakeLists.txt
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 

Repository files navigation

microlog

CI License: MIT C99

Structured logging for embedded systems in portable C99.

No third-party runtime dependencies. Zero dynamic allocation. Pluggable backends. Predictable output.

Features

  • Five runtime levels: TRACE, DEBUG, INFO, WARN, ERROR
  • Compile-time stripping via MLOG_LEVEL_MIN
  • Runtime global and per-backend filters
  • Multiple backends with per-backend color selection
  • Optional timestamps via one clock callback sample per event
  • Deterministic truncation with newline termination
  • C99 logging macros that compile without GNU variadic extensions
  • Hex dump helper for byte-oriented diagnostics

Quick Start

#include "mlog.h"

static void uart_write(const char *buf, uint16_t len, mlog_level_t level, void *ctx)
{
    (void)level;
    (void)ctx;
    HAL_UART_Transmit(&huart2, (uint8_t *)buf, len, 100);
}

void logging_init(void)
{
    mlog_backend_t backend = {
        .write = uart_write,
        .ctx = NULL,
        .level = MLOG_INFO,
        .color = false,
    };

    mlog_t *log = mlog_global();
    mlog_set_clock(log, HAL_GetTick);
    mlog_add_backend(log, &backend);
}

void app_run(void)
{
    MLOG_INFO("BOOT", "ready");
    MLOG_WARN("BATT", "Low battery: %u%%", 17u);
}

Behavior Notes

  • Every emitted record ends with \n.
  • If ANSI color output is enabled for a backend, microlog reserves room for the reset sequence before the newline.
  • Long tags and messages are truncated deterministically to preserve a terminating NUL and the final line ending.
  • MLOG_NONE is a filter-only level. It must not be used as an emitted message level.
  • Backend callbacks are synchronous. The callback buffer is borrowed stack storage and must be copied before deferred use.
  • Backend write failures are not propagated through the API.
  • The library is not internally synchronized. Concurrent access and recursive logging require external discipline.

Build

Manual build:

cc -std=c99 -Wall -Wextra -Wpedantic -Iinclude src/mlog.c tests/test_all.c -o test_all
./test_all

Local make-based test flow:

make -C tests
make -C tests compile-checks

CMake package flow:

cmake -S . -B build -DMICROLOG_BUILD_TESTS=ON
cmake --build build
ctest --test-dir build --output-on-failure
cmake --install build --prefix install

Documentation

  • API Reference
  • Cookbook
  • Design
  • Porting Guide
  • Troubleshooting
  • Verification
  • Contributing
  • Security
  • Changelog
  • Release Workflow

Recommended reading order for new consumers:

  1. README.md
  2. docs/COOKBOOK.md
  3. docs/API_REFERENCE.md
  4. docs/TROUBLESHOOTING.md
  5. docs/VERIFICATION.md

Releases are tag-based. Branch pushes do not create releases; only pushed v* tags trigger .github/workflows/release.yml.

License

MIT License. See LICENSE.

About

Structured logging for embedded systems in C99 with zero allocations, pluggable backends, and portable integration.

Topics

cc99diagnosticsembeddedembedded-systemsfirmwarelibraryloggingobservabilityportableuartzero-allocation

Resources

Readme
MIT license

Contributing

Contributing

Security policy

Security policy
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.