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:
Aleksander Morgado
2017-05-29 13:42:23 +02:00
parent 3bb0f7e66d
commit 57f193bd04
3 changed files with 3 additions and 8 deletions

View File

@@ -143,7 +143,6 @@ main (int argc, char *argv[])
mm_context_get_log_file (),
mm_context_get_log_timestamps (),
mm_context_get_log_relative_timestamps (),
mm_context_get_debug (),
&err)) {
g_warning ("Failed to set up logging: %s", err->message);
g_error_free (err);

View File

@@ -47,7 +47,6 @@ static gboolean ts_flags = TS_FLAG_NONE;
static guint32 log_level = LOGL_INFO | LOGL_WARN | LOGL_ERR;
static GTimeVal rel_start = { 0, 0 };
static int logfd = -1;
static gboolean func_loc = FALSE;
typedef struct {
guint32 num;
@@ -117,8 +116,9 @@ _mm_log (const char *loc,
g_string_append_printf (msgbuf, "[%06ld.%06ld] ", secs, usecs);
}
if (func_loc && log_level & LOGL_DEBUG)
g_string_append_printf (msgbuf, "[%s] %s(): ", loc, func);
#if defined MM_LOG_FUNC_LOC
g_string_append_printf (msgbuf, "[%s] %s(): ", loc, func);
#endif
va_start (args, fmt);
g_string_append_vprintf (msgbuf, fmt, args);
@@ -209,15 +209,12 @@ mm_log_setup (const char *level,
const char *log_file,
gboolean show_timestamps,
gboolean rel_timestamps,
gboolean debug_func_loc,
GError **error)
{
/* levels */
if (level && strlen (level) && !mm_log_set_level (level, error))
return FALSE;
func_loc = debug_func_loc;
if (show_timestamps)
ts_flags = TS_FLAG_WALL;
else if (rel_timestamps)

View File

@@ -53,7 +53,6 @@ gboolean mm_log_setup (const char *level,
const char *log_file,
gboolean show_ts,
gboolean rel_ts,
gboolean debug_func_loc,
GError **error);
void mm_log_shutdown (void);