Fork me on GitHub
Loading...
Searching...
No Matches
Data Fields
janus_logger Struct Reference

The logger plugin session and callbacks interface. More...

#include <logger.h>

Data Fields

int(*const init )(const char *server_name, const char *config_path)
 Logger plugin initialization/constructor.
 
void(*const destroy )(void)
 Logger plugin deinitialization/destructor.
 
int(*const get_api_compatibility )(void)
 Informative method to request the API version this logger plugin was compiled against.
 
int(*const get_version )(void)
 Informative method to request the numeric version of the logger plugin.
 
const char *(*const get_version_string )(void)
 Informative method to request the string version of the logger plugin.
 
const char *(*const get_description )(void)
 Informative method to request a description of the logger plugin.
 
const char *(*const get_name )(void)
 Informative method to request the name of the logger plugin.
 
const char *(*const get_author )(void)
 Informative method to request the author of the logger plugin.
 
const char *(*const get_package )(void)
 Informative method to request the package name of the logger plugin (what will be used in web applications to refer to it)
 
void(*const incoming_logline )(int64_t timestamp, const char *line)
 Method to notify the logger plugin that a new log line is available.
 
json_t *(*const handle_request )(json_t *request)
 Method to send a request to this specific logger plugin.
 

Detailed Description

The logger plugin session and callbacks interface.

Field Documentation

◆ destroy

void(*const janus_logger::destroy) (void)

Logger plugin deinitialization/destructor.

◆ get_api_compatibility

int(*const janus_logger::get_api_compatibility) (void)

Informative method to request the API version this logger plugin was compiled against.

Note
All logger plugins MUST implement this method and return JANUS_LOGGER_API_VERSION to make this work, or they will be rejected by the core.

◆ get_author

const char *(*const janus_logger::get_author) (void)

Informative method to request the author of the logger plugin.

◆ get_description

const char *(*const janus_logger::get_description) (void)

Informative method to request a description of the logger plugin.

◆ get_name

const char *(*const janus_logger::get_name) (void)

Informative method to request the name of the logger plugin.

◆ get_package

const char *(*const janus_logger::get_package) (void)

Informative method to request the package name of the logger plugin (what will be used in web applications to refer to it)

◆ get_version

int(*const janus_logger::get_version) (void)

Informative method to request the numeric version of the logger plugin.

◆ get_version_string

const char *(*const janus_logger::get_version_string) (void)

Informative method to request the string version of the logger plugin.

◆ handle_request

json_t *(*const janus_logger::handle_request) (json_t *request)

Method to send a request to this specific logger plugin.

The method takes a Jansson json_t, that contains all the info related to the request. This object will come from an Admin API request, and is meant to represent a synchronous request. Since each logger can have its own bells and whistles, there's no constraint on what this object should contain, which is entirely logger-specific. A json_t object needs to be returned as a response, which will be sent in response to the Admin API call. This can be useful to tweak settings in real-time, or to probe the internals of the logger plugin for monitoring purposes.

Parameters
[in]requestJansson object containing the request
Returns
A Jansson object containing the response for the client

◆ incoming_logline

void(*const janus_logger::incoming_logline) (int64_t timestamp, const char *line)

Method to notify the logger plugin that a new log line is available.

All log lines are notified as a string

Note
Do NOT handle the log line directly in this method. Janus sends log lines from its internal logger thread, so any I/O or blocking thing you may be doing here would most likely end up slowing it down. Just take note of it and handle it somewhere else. It's your responsibility to duplicate the string to use it later: the string you get in the callback is NOT a copy, and MUST NOT be modified.
Parameters
[in]timestampMonotonic timestamp of when the log line was printed
[in]lineString containing the log line

◆ init

int(*const janus_logger::init) (const char *server_name, const char *config_path)

Logger plugin initialization/constructor.

Parameters
[in]server_nameName of the Janus instance generating the logs
[in]config_pathPath of the folder where the configuration for this logger plugin can be found
Returns
0 in case of success, a negative integer in case of error

The documentation for this struct was generated from the following file: