I am finding a way to implement a log mechanism that several processes write their behaviors (mainly for error and execution sequence of processes) to it by C with Linux?
Just open a file that shared for multi-processes and let processes fprintf() to it? Any smart way to implement an option/mechanism that controls the level of log such as error/detail/high or something like it?
It would be better if you could refer me to a light opensource for this?
Thanks.
Use syslog, it's the standard (POSIX) logging solution.
In other languages, log4c is very popular (log4j, log4net). It has a lot of functionality just baked in, and since it is so common, other developers who work on your code will be familiar with it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With