Logging
Closed this issue · 2 comments
tbobm commented
Create / add a global logging library
Bonus point if async.
Should be able to:
- Have different log levels
- Display timestamp
- Filename / line ?
- Configuration based on file (or arguments from CLI, if necessary)
- Message
Can be printf-based, of course. Like, printf's formatting.
Extra bonus point if handles HTTP requests with POST.
The functions should be available through a library. Best should be to use it as a dynamic library (.so/.dylib), in order to use printf for the server development, then easily switch to real logging using this library.
I'm available on this subject to help you package this.
Usage
#include "logging.h"
# or something along these lines
int main(void) {
log_info("starting program");
log_debug("less useful information");
return (0);
}
/*
* log_info, log_debug, log_error can be implicit wrapper around another function,
* log(int level, char *str, ...);
*/
Output
Stdout is a must-have. Having the option to write to a file or even /var/log/softwar.log
would be really great too.
tbobm commented
tbobm commented
Concrete usage:
log_trace(const char *fmt, ...);
log_debug(const char *fmt, ...);
log_info(const char *fmt, ...);
log_warn(const char *fmt, ...);
log_error(const char *fmt, ...);
log_fatal(const char *fmt, ...);