Sign inSign up

bitsgenix/log.c

By bitsgenix

•Updated 9 days ago

Image
1

103

bitsgenix/log.c repository overview

⁠m-mdy-m/log.c

m-mdy-m/log.c is a small C11 logging library. It writes TRACE, DEBUG, INFO, WARN, ERROR, and FATAL messages to the console, a file, or an application callback. The core has no third-party runtime dependency and provides a stable C ABI for language bindings.

⁠What it is

m-mdy-m/log.c started from the original rxi/log.c⁠, keeping its simple goal: a small logger that is easy to add to a C program. It has since been redesigned around explicit logger instances, structured records, configurable output sinks, and a versioned C ABI.

The library does not know anything about your application or its business logic. Your code decides what to log, when to log, and which metadata to attach. The logger formats each record and sends it to the console, an append-only file, or a callback. Other languages can use the non-variadic mmlog_logger_write() ABI entry point.

⁠Build

git clone https://github.com/m-mdy-m/log.c.git
cd log.c
make
make check

To install locally on a Unix-like system:

make install PREFIX="$HOME/.local"

See Installation and build⁠ for CMake, Windows, release packages, and linking options.

⁠Use

#include <m-mdy-m/log.h>

int main(void) {
    mmlog_logger_config_t config;
    mmlog_logger_t *logger = NULL;

    if (mmlog_logger_config_init(&config) != MMLLOG_OK) return 1;
    if (mmlog_logger_create(&config, &logger) != MMLLOG_OK) return 1;

    MMLLOG_INFO(logger, "service started");

    mmlog_logger_destroy(logger);
    return 0;
}

Compile this example directly from the source tree:

cc -std=c11 -Wall -Wextra -Wpedantic -Iinclude app.c src/log.c -o app
./app

For more examples, see examples/c/basic.c⁠.

⁠Documentation

⁠Project policies

Contributing⁠ · Code of Conduct⁠ · Security⁠

⁠License

MIT. See LICENSE⁠ and NOTICE⁠ for license and upstream attribution.

⁠Credits

  • Based on the original rxi/log.c⁠ by rxi (MIT).
  • The redesigned API, structured records, ABI, bindings, tests, build system, and documentation are maintained in this repository.
  • See NOTICE⁠ for project lineage and attribution.

Tag summary

Content type

Image

Digest

sha256:6021274e0…

Size

182.3 MB

Last updated

9 days ago

docker pull bitsgenix/log.c