Fork me on GitHub
logger.h
Go to the documentation of this file.
1 
69 #ifndef JANUS_LOGGER_H
70 #define JANUS_LOGGER_H
71 
72 #include <stdlib.h>
73 #include <stdint.h>
74 #include <stdio.h>
75 #include <string.h>
76 #include <ctype.h>
77 #include <unistd.h>
78 #include <inttypes.h>
79 
80 #include <glib.h>
81 #include <jansson.h>
82 
83 #include "../utils.h"
84 
85 
87 #define JANUS_LOGGER_API_VERSION 3
88 
104 #define JANUS_LOGGER_INIT(...) { \
105  .init = NULL, \
106  .destroy = NULL, \
107  .get_api_compatibility = NULL, \
108  .get_version = NULL, \
109  .get_version_string = NULL, \
110  .get_description = NULL, \
111  .get_name = NULL, \
112  .get_author = NULL, \
113  .get_package = NULL, \
114  .incoming_logline = NULL, \
115  ## __VA_ARGS__ }
116 
117 
119 typedef struct janus_logger janus_logger;
120 
121 
123 struct janus_logger {
128  int (* const init)(const char *server_name, const char *config_path);
130  void (* const destroy)(void);
131 
135  int (* const get_api_compatibility)(void);
137  int (* const get_version)(void);
139  const char *(* const get_version_string)(void);
141  const char *(* const get_description)(void);
143  const char *(* const get_name)(void);
145  const char *(* const get_author)(void);
147  const char *(* const get_package)(void);
148 
159  void (* const incoming_logline)(int64_t timestamp, const char *line);
160 
172  json_t *(* const handle_request)(json_t *request);
173 };
174 
176 typedef janus_logger* create_l(void);
177 
178 #endif
janus_logger::destroy
void(*const destroy)(void)
Logger plugin deinitialization/destructor.
Definition: logger.h:130
janus_logger::init
int(*const init)(const char *server_name, const char *config_path)
Logger plugin initialization/constructor.
Definition: logger.h:128
janus_logger
The logger plugin session and callbacks interface.
Definition: logger.h:123
json_t
struct json_t json_t
Definition: plugin.h:236
create_l
janus_logger * create_l(void)
The hook that logger plugins need to implement to be created from the Janus core.
Definition: logger.h:176
janus_logger::get_description
const char *(*const get_description)(void)
Informative method to request a description of the logger plugin.
Definition: logger.h:141
janus_logger::get_author
const char *(*const get_author)(void)
Informative method to request the author of the logger plugin.
Definition: logger.h:145
janus_logger::handle_request
json_t *(*const handle_request)(json_t *request)
Method to send a request to this specific logger plugin.
Definition: logger.h:172
janus_logger::incoming_logline
void(*const incoming_logline)(int64_t timestamp, const char *line)
Method to notify the logger plugin that a new log line is available.
Definition: logger.h:159
janus_logger::get_version
int(*const get_version)(void)
Informative method to request the numeric version of the logger plugin.
Definition: logger.h:137
janus_logger::get_package
const char *(*const get_package)(void)
Informative method to request the package name of the logger plugin (what will be used in web applica...
Definition: logger.h:147
janus_logger::get_api_compatibility
int(*const get_api_compatibility)(void)
Informative method to request the API version this logger plugin was compiled against.
Definition: logger.h:135
janus_logger::get_name
const char *(*const get_name)(void)
Informative method to request the name of the logger plugin.
Definition: logger.h:143
janus_logger::get_version_string
const char *(*const get_version_string)(void)
Informative method to request the string version of the logger plugin.
Definition: logger.h:139