-
Notifications
You must be signed in to change notification settings - Fork 244
Logging
Logging in flinux is not easy as it seems. Because we often need to diagnose problems in multi process sessions, and sometimes we need to find problems during an interactive session, traditional log files are not easy to use and implement in this case. They are also often very slow if a large number of lines are written to flushed to the disk.
For this reason the flog
log is crafted to specifically handle the needs of logging in flinux.
- Zero overhead when logging is not enabled
- Easy to use: fire up flog and see flinux logs itself right away
- Log multi process and multi thread sessions properly
- Fast communication: the performance impact of logging is negligible
The interprocess logging is implemented by using a named pipe server created in flog. At the very beginning of flinux it calls log_init()
, which tries to open a connection to the named pipe server. If that succeeds, it set the global flag logger_attached
to true.
All the logging functions log_*()
are actually macros which first checks if logger_attached
is true, then pass the arguments to the actual log_*_internal()
implementations. This means when the logger is not attached, even the arguments to the log functions are not evaluated, thus guarantees zero overhead.
Before reporting potential bugs, please see Report a bug first.
Alternatively, you could also talk via gitter or #flinux at freenode.