Statistics
| Branch: | Revision:

janus-gateway / log.h @ f82a8605

History | View | Annotate | Download (1.75 KB)

1
/*! \file    log.h
2
 * \author   Jay Ridgeway <jayridge@gmail.com>
3
 * \copyright GNU General Public License v3
4
 * \brief    Buffered logging (headers)
5
 * \details  Implementation of a simple buffered logger designed to remove
6
 * I/O wait from threads that may be sensitive to such delays. Buffers are
7
 * saved and reused to reduce allocation calls. The logger output can then
8
 * be printed to stdout and/or a log file.
9
 *
10
 * \ingroup core
11
 * \ref core
12
 */
13

    
14
#ifndef _JANUS_LOG_H
15
#define _JANUS_LOG_H
16

    
17
#include <stdio.h>
18
#include <glib.h>
19

    
20
/*! \brief Buffered vprintf
21
* @param[in] format Format string as defined by glib
22
* @param[in] args Parameters to insert into formatted string
23
* \note This output is buffered and may not appear immediately on stdout. */
24
void janus_vprintf(const char *format, ...) G_GNUC_PRINTF(1, 2);
25

    
26
/*! \brief Log initialization
27
* \note This should be called before attempting to use the logger. A buffer
28
* pool and processing thread are created.
29
* @param console Whether the output should be printed on stdout or not
30
* @param logfile Log file to save the output to, if any
31
* @returns 0 in case of success, a negative integer otherwise */
32
int janus_log_init(gboolean console, const char *logfile);
33
/*! \brief Log destruction */
34
void janus_log_destroy(void);
35

    
36
/*! \brief Method to check whether stdout logging is enabled
37
 * @returns TRUE if stdout logging is enabled, FALSE otherwise */
38
gboolean janus_log_is_stdout_enabled(void);
39
/*! \brief Method to check whether file-based logging is enabled
40
 * @returns TRUE if file-based logging is enabled, FALSE otherwise */
41
gboolean janus_log_is_logfile_enabled(void);
42
/*! \brief Method to get the path to the log file
43
 * @returns The full path to the log file, or NULL otherwise */
44
char *janus_log_get_logfile_path(void);
45

    
46
#endif