log: remove func loc info unless MM_LOG_FUNC_LOC is defined
The user can build the project passing custom CFLAGS to enable the function location information, e.g.: $ ./configure --prefix=/usr CFLAGS="-DMM_LOG_FUNC_LOC"
This commit is contained in:
@@ -143,7 +143,6 @@ main (int argc, char *argv[])
|
|||||||
mm_context_get_log_file (),
|
mm_context_get_log_file (),
|
||||||
mm_context_get_log_timestamps (),
|
mm_context_get_log_timestamps (),
|
||||||
mm_context_get_log_relative_timestamps (),
|
mm_context_get_log_relative_timestamps (),
|
||||||
mm_context_get_debug (),
|
|
||||||
&err)) {
|
&err)) {
|
||||||
g_warning ("Failed to set up logging: %s", err->message);
|
g_warning ("Failed to set up logging: %s", err->message);
|
||||||
g_error_free (err);
|
g_error_free (err);
|
||||||
|
@@ -47,7 +47,6 @@ static gboolean ts_flags = TS_FLAG_NONE;
|
|||||||
static guint32 log_level = LOGL_INFO | LOGL_WARN | LOGL_ERR;
|
static guint32 log_level = LOGL_INFO | LOGL_WARN | LOGL_ERR;
|
||||||
static GTimeVal rel_start = { 0, 0 };
|
static GTimeVal rel_start = { 0, 0 };
|
||||||
static int logfd = -1;
|
static int logfd = -1;
|
||||||
static gboolean func_loc = FALSE;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
guint32 num;
|
guint32 num;
|
||||||
@@ -117,8 +116,9 @@ _mm_log (const char *loc,
|
|||||||
g_string_append_printf (msgbuf, "[%06ld.%06ld] ", secs, usecs);
|
g_string_append_printf (msgbuf, "[%06ld.%06ld] ", secs, usecs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (func_loc && log_level & LOGL_DEBUG)
|
#if defined MM_LOG_FUNC_LOC
|
||||||
g_string_append_printf (msgbuf, "[%s] %s(): ", loc, func);
|
g_string_append_printf (msgbuf, "[%s] %s(): ", loc, func);
|
||||||
|
#endif
|
||||||
|
|
||||||
va_start (args, fmt);
|
va_start (args, fmt);
|
||||||
g_string_append_vprintf (msgbuf, fmt, args);
|
g_string_append_vprintf (msgbuf, fmt, args);
|
||||||
@@ -209,15 +209,12 @@ mm_log_setup (const char *level,
|
|||||||
const char *log_file,
|
const char *log_file,
|
||||||
gboolean show_timestamps,
|
gboolean show_timestamps,
|
||||||
gboolean rel_timestamps,
|
gboolean rel_timestamps,
|
||||||
gboolean debug_func_loc,
|
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
/* levels */
|
/* levels */
|
||||||
if (level && strlen (level) && !mm_log_set_level (level, error))
|
if (level && strlen (level) && !mm_log_set_level (level, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
func_loc = debug_func_loc;
|
|
||||||
|
|
||||||
if (show_timestamps)
|
if (show_timestamps)
|
||||||
ts_flags = TS_FLAG_WALL;
|
ts_flags = TS_FLAG_WALL;
|
||||||
else if (rel_timestamps)
|
else if (rel_timestamps)
|
||||||
|
@@ -53,7 +53,6 @@ gboolean mm_log_setup (const char *level,
|
|||||||
const char *log_file,
|
const char *log_file,
|
||||||
gboolean show_ts,
|
gboolean show_ts,
|
||||||
gboolean rel_ts,
|
gboolean rel_ts,
|
||||||
gboolean debug_func_loc,
|
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
void mm_log_shutdown (void);
|
void mm_log_shutdown (void);
|
||||||
|
Reference in New Issue
Block a user