~ubuntu-branches/ubuntu/raring/tracker/raring

« back to all changes in this revision

Viewing changes to src/libtracker-common/tracker-log.c

  • Committer: Package Import Robot
  • Author(s): Michael Biebl
  • Date: 2011-12-16 18:47:47 UTC
  • mfrom: (4.3.22 sid)
  • Revision ID: package-import@ubuntu.com-20111216184747-0cqqd53tx91buc44
Tags: 0.12.9-1
* New upstream release.
* Change section of gir1.2-tracker-0.12 to introspection.
* Update homepage URL. (Closes: #652141)

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
#include "tracker-file-utils.h"
36
36
 
37
37
static gboolean  initialized;
38
 
static GMutex   *mutex;
39
38
static FILE     *fd;
40
39
static gint      verbosity;
41
40
static guint     log_handler_id;
42
41
 
 
42
#if GLIB_CHECK_VERSION (2,31,0)
 
43
static GMutex    mutex;
 
44
#else
 
45
static GMutex   *mutex;
 
46
#endif
 
47
 
43
48
static inline void
44
49
log_output (const gchar    *domain,
45
50
            GLogLevelFlags  log_level,
56
61
        g_return_if_fail (message != NULL && message[0] != '\0');
57
62
 
58
63
        /* Ensure file logging is thread safe */
 
64
#if GLIB_CHECK_VERSION (2,31,0)
 
65
        g_mutex_lock (&mutex);
 
66
#else
59
67
        g_mutex_lock (mutex);
 
68
#endif
60
69
 
61
70
        /* Check log size, 10MiB limit */
62
71
        if (size > (10 << 20) && fd) {
113
122
 
114
123
        g_free (output);
115
124
 
 
125
#if GLIB_CHECK_VERSION (2,31,0)
 
126
        g_mutex_unlock (&mutex);
 
127
#else
116
128
        g_mutex_unlock (mutex);
 
129
#endif
117
130
}
118
131
 
119
132
static void
185
198
        }
186
199
 
187
200
        verbosity = CLAMP (this_verbosity, 0, 3);
 
201
 
 
202
#if GLIB_CHECK_VERSION (2,31,0)
 
203
        g_mutex_init (&mutex);
 
204
#else
188
205
        mutex = g_mutex_new ();
 
206
#endif
189
207
 
190
208
        switch (this_verbosity) {
191
209
                /* Log level 3: EVERYTHING */
256
274
                fclose (fd);
257
275
        }
258
276
 
 
277
#if GLIB_CHECK_VERSION (2,31,0)
 
278
        g_mutex_clear (&mutex);
 
279
#else
259
280
        g_mutex_free (mutex);
 
281
#endif
260
282
 
261
283
        initialized = FALSE;
262
284
}