Coder Social home page Coder Social logo

zma / zlog Goto Github PK

View Code? Open in Web Editor NEW
58.0 6.0 18.0 72 KB

A low-latency in-memory C logging library

Home Page: https://www.ericzma.com/projects/zlog/

License: The Unlicense

C 78.90% Makefile 2.12% Meson 18.98%
c in-memory logger logging logging-library

zlog's Introduction

zlog - a C In-memory Logging Library

Hompage: https://www.ericzma.com/projects/zlog/

Introduction

zlog is a C in-memory logging library. It allocates a buffer in memory for logging, and flush the buffer to the log file (or stdout) when the buffer is full, or it is instructed explicitly by the program or flushing thread.

Usage example

Example.c represents an use example of zlog library containing both INFO and DEBUG messages. If you want to include DEBUG messages you must compile with -D DEBUG flag.

Makefile contains the corresponding gcc compilation commands to both INFO and DEBUG mode. Please keep in mind that DEBUG mode will log INFO and DEBUG messages whilst INFO mode will discard all DEBUG messages. The following Make commands can be used to compile either in DEBUG or INFO modes:

  • make or make info for INFO mode compilation.
  • make debug for DEBUG mode compilation.

Source code

Source code of zlog can be downloaded from http://github.com/zma/zlog/ . The source code is released into the public domain.

Authors and contributors

zlog's People

Contributors

dreamer-coding-555 avatar razvioverflow avatar res0nance avatar squidfarts avatar zma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

zlog's Issues

Compiler warnings: format-truncation

Hi,

I hit this issue when compiling with GCC 8 with -Wall:

zlog/zlog.c: In function ‘zlogf_time’:
zlog/zlog.c:172:51: error: ‘.’ directive output may be truncated writing 1 byte into a region of size between 0 and 127 [-Werror=format-truncation=]
     snprintf(buffer, ZLOG_BUFFER_STR_MAX_LEN, "[%s.%06lds] ", timebuf, tv.tv_usec);
                                                   ^
zlog/zlog.c:172:5: note: ‘snprintf’ output between 12 and 153 bytes into a destination of size 128
     snprintf(buffer, ZLOG_BUFFER_STR_MAX_LEN, "[%s.%06lds] ", timebuf, tv.tv_usec);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
zlog/zlog.c: In function ‘zlog_time’:
zlog/zlog.c:203:51: error: ‘.’ directive output may be truncated writing 1 byte into a region of size between 0 and 127 [-Werror=format-truncation=]
     snprintf(buffer, ZLOG_BUFFER_STR_MAX_LEN, "[%s.%06lds] [@%s:%d]", timebuf, tv.tv_usec, filename, line);
                                                   ^
zlog/zlog.c:203:5: note: ‘snprintf’ output 17 or more bytes (assuming 144) into a destination of size 128
     snprintf(buffer, ZLOG_BUFFER_STR_MAX_LEN, "[%s.%06lds] [@%s:%d]", timebuf, tv.tv_usec, filename, line);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Thanks for zlog! :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.