

Nanosecond C message logger
source link: https://www.tuicool.com/articles/hit/yU3iUzY
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Hello,
Some time ago I did a data logger for fun, just to check if I could beat the performance of an old C++ project of mine (mini-async-log) and to avoid letting my multithreading-C skills rust when on a non-programming gig (using Yocto/OE, very little programming).
This project is a BSD licensed, producer-wait-free (when using thread-local storage) generic message logger with high performance, decent test coverage, and type-safe C strings (requires C11 or C++ compiler).
It was a shame to let this project to die unknown, as I think that it has potential to be used on some niches as network programs, HFT, games, etc. so here I am sharing it.
https://github.com/RafaGago/mini-async-log
This was an evolution of a similar logger I did, this time I wanted to achieve wait-free producers, so this implementation can use thread-local storage to achieve that. Some other non allocation-free strategies are also available.
I still aimed for as easy as possible usage/learning curve and maintenance vs lots of features.
It has some interesting things too:
-It has one modification on Djukov's MPMC queue to make it MPSC and accepting variable (but limited) bucket size allocations (at the expense of unfairness towards bigger buckets). There are more modifications/variations on this Djukov queue on the library where I'm collecting all the generic stuff that I use when developing C programs.
-The project still maintains automatic type detection of the string formatters by using "clever" hardcore C preprocessor abuse mixed with C11 type-generic expressions. It still accepts most non-type printf modifiers. This is at the same time beautiful and ugly (you know what I mean), for the uglyness part, automated testing is available.
NOTE: Untested on Windows.
Recommend
-
95
Zero Allocation JSON Logger The zerolog package provides a fast and simple logger dedicated to JSON output. Zerolog's API is designed to provide both a great developer experience and stunning
-
47
logger, psr logger, namespaced logger, monolog logger, monolog, monolog-cascade, monolog-cascade-namespaced, log4j, php log4j, php log4j logger
-
30
Yes, git is a wonderful thing. In this tutorial, I will introduce a tool I wrote called git-logger. This program creates a visual representation of the times of the week where your git project has been busiest (similar to a work punch card). For...
-
36
lines-logger A simple browser logger that features: Colored tags Show origin source files...
-
45
log2json2stdout What this is it? This is simple logger for JavaScript programs. All logs going to stdout, because apps is not a place where logs should be processed. Output in JS...
-
59
README.md wlog Simple log level based Go logger. Provides an io.Writer that filters log messages based on a log level prefix. Valid log levels are: DEB...
-
45
README.md NanoLog Nanolog is an extremely performant nanosecond scale logging system for C++ that exposes a simple printf-like API and achiev...
-
54
Do you find yourself writing puts statements all throughout your code - only to check which chunks are burning the most...
-
34
In the physical world, nanotechnology predictably brings us surprises. Being structured on nano-scale, the most common materials, such as carbon, iron or copper, gain new unforeseen properties. What we know about them on t...
-
30
README.md pino Â
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK