Adjust the default logformat.

The file, line and function information is now only printed for error
and debug messages.
This commit is contained in:
Jef Driesen 2012-08-25 18:37:47 +02:00
parent ea3f833d8d
commit 55c16d0d0f
2 changed files with 10 additions and 2 deletions

View File

@ -58,5 +58,9 @@ logfunc (dc_context_t *context, dc_loglevel_t loglevel, const char *file, unsign
{
const char *loglevels[] = {"NONE", "ERROR", "WARNING", "INFO", "DEBUG", "ALL"};
message ("%s: %s [in %s:%d (%s)]\n", loglevels[loglevel], msg, file, line, function);
if (loglevel == DC_LOGLEVEL_ERROR || loglevel == DC_LOGLEVEL_WARNING) {
message ("%s: %s [in %s:%d (%s)]\n", loglevels[loglevel], msg, file, line, function);
} else {
message ("%s: %s\n", loglevels[loglevel], msg);
}
}

View File

@ -126,7 +126,11 @@ logfunc (dc_context_t *context, dc_loglevel_t loglevel, const char *file, unsign
{
const char *loglevels[] = {"NONE", "ERROR", "WARNING", "INFO", "DEBUG", "ALL"};
fprintf (stderr, "%s: %s [in %s:%d (%s)]\n", loglevels[loglevel], msg, file, line, function);
if (loglevel == DC_LOGLEVEL_ERROR || loglevel == DC_LOGLEVEL_WARNING) {
fprintf (stderr, "%s: %s [in %s:%d (%s)]\n", loglevels[loglevel], msg, file, line, function);
} else {
fprintf (stderr, "%s: %s\n", loglevels[loglevel], msg);
}
}
#endif