libtgvoip
libtgvoip copied to clipboard
Logs are written into stdout
I've noticed that under linux logs are written into stdout
. If some program links to libtgvoip and uses stdout
for its own purpose, there is no way to separate ordinary output from the program and logging output made by libtgvoip.
Is not it a good practice for libraries to write logs/diagnostics to stderr
instead of stdout
?
I'm really not sure about this one as I've seen libraries writing logs to stdout. There is a define to control this (TGVOIP_LOG_VERBOSITY=0..5
) where 5 is most verbose and 0 is no logging. You're probably right that there needs to be a way to control stdout/logcat/NSLog logging separately from file logging (to a file you optionally specify in config) or even to specify a custom logging function.
Yeah, I’m currently disabled logging via TGVOIP_LOG_VERBOSITY
, but having active logs from tgvoip is very helpful. Custom log func sounds great! Or at least having some custom FILE*
to write logs to
I like tdlib's approach for logging: it writes logs into specified file and rotates it after exceeding specified size. It also has logging level customizable at runtime