X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fshl_log.c;h=9acae87b4d9488f687921e6e140f77ef2d41d324;hb=refs%2Fheads%2Ftizen_3.0.2014.q3_common;hp=5b726a410843e01bc09aa019bfc3682d669de489;hpb=9c2375b6d4e725f0757d7df83473177234425dc4;p=platform%2Fupstream%2Fkmscon.git diff --git a/src/shl_log.c b/src/shl_log.c index 5b726a4..9acae87 100644 --- a/src/shl_log.c +++ b/src/shl_log.c @@ -320,8 +320,8 @@ int log_set_file(const char *file) if (file) { f = fopen(file, "a"); if (!f) { - log_err("cannot change log-file to %s (%d): %s", - file, errno, strerror(errno)); + log_err("cannot change log-file to %s (%d): %m", + file, errno); return -EFAULT; } } else { @@ -386,6 +386,8 @@ static void log__submit(const char *file, const char *prefix = NULL; FILE *out; long long sec, usec; + bool nl; + size_t len; if (log__omit(file, line, func, config, subs, sev)) return; @@ -414,19 +416,20 @@ static void log__submit(const char *file, fprintf(out, "[%.4lld.%.6lld] ", sec, usec); } + len = strlen(format); + nl = format[len - 1] == '\n'; + + if (!func) + func = ""; + if (!file) + file = ""; + if (line < 0) + line = 0; + vfprintf(out, format, args); - if (sev == LOG_DEBUG) { - if (!func) - func = ""; - if (!file) - file = ""; - if (line < 0) - line = 0; + if (!nl) fprintf(out, " (%s() in %s:%d)\n", func, file, line); - } else { - fprintf(out, "\n"); - } } static void log__format(const char *file,