8000 GitHub - alexishachemi/clogger: Epitech coding-style-compliant logging utility in C
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

alexishachemi/clogger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clogger

A simple logger in C

clogger is a simple logging utility in C. It was made with the intention to be used in my EPITECH projects so it is compliant with the EPITECH coding style rules.

Dependencies

Building

to build the library you can use the included Makefile:

make

It will then build the libclogger.a binary

Installing

You can install the library into your system using the following command:

make install

You can then uninstall it using:

make uninstall

Usage

See the following example code:

#include <clogger.h>

int main(void)
{
    logger_t logger;

    if (!logger_init(&logger, NULL, true, stdout))
        return 84;
    LOG(&logger, WARN, "Hello, world!"<
5163
/span>);
    logger_deinit(&logger);
    return 0;
}

Logging uses the vsnprintf function so it is compatible with the printf format identifiers. The maximum length of a log line is set by LOG_SIZE (see clogger.h)

You also need to add the library to the linker when compiling:

gcc myfile.c -lclogger

Running the code will print a similar line on the standard output:

INFO - May 14 2024 13:48:21 - tests/main.c:16 - Hello, world!

When logging into a file, if the file has more than LOG_MAX_LINES lines, is is cleared first.

About

Epitech coding-style-compliant logging utility in C

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0