logsys.c File Reference
`#include <config.h>`
`#include <stdint.h>`
`#include <ctype.h>`
`#include <assert.h>`
`#include <stdio.h>`
`#include <string.h>`
`#include <qb/qbdefs.h>`
`#include <qb/qbutil.h>`
`#include <qb/qblog.h>`
`#include <corosync/logsys.h>`
Include dependency graph for logsys.c:

Go to the source code of this file.

## Data Structures

struct | syslog_names
struct | logsys_logger

## Macros

#define | MAX_FILES_PER_SUBSYS 32
#define | IPC_LOGSYS_SIZE 8192*1024
#define | LOGSYS_LOGGER_INIT_DONE 0
#define | LOGSYS_LOGGER_NEEDS_INIT 1

## Functions

void | logsys_system_fini (void)
| logsys_system_fini More...
int | _logsys_system_setup (const char *mainsystem, unsigned int mode, int syslog_facility, int syslog_priority)
| _logsys_system_setup More...
int | _logsys_subsys_create (const char *subsys, const char *filename)
| _logsys_subsys_create More...
int | _logsys_config_subsys_get (const char *subsys)
| _logsys_config_subsys_get More...
int | logsys_config_mode_set (const char *subsys, unsigned int mode)
| logsys_config_mode_set More...
unsigned int | logsys_config_mode_get (const char *subsys)
| logsys_config_mode_get More...
int | logsys_config_file_set (const char *subsys, const char **error_string, const char *file)
| to close a logfile, just invoke this function with a NULL file or if you want to change logfile, the old one will be closed for you. More...
int | logsys_format_set (const char *format)
| configuration bits that can only be done for the whole system More...
char * | logsys_format_get (void)
| logsys_format_get More...
int | logsys_config_syslog_facility_set (const char *subsys, unsigned int facility)
| per system/subsystem settings. More...
int | logsys_config_syslog_priority_set (const char *subsys, unsigned int priority)
| logsys_config_syslog_priority_set More...
int | logsys_config_logfile_priority_set (const char *subsys, unsigned int priority)
| logsys_config_logfile_priority_set More...
void | logsys_config_apply (void)
| logsys_config_apply More...
int | logsys_config_debug_set (const char *subsys, unsigned int debug)
| enabling debug, disable message priority filtering. More...
int | logsys_priority_id_get (const char *name)
| logsys_priority_id_get More...
int | logsys_thread_start (void)
| logsys_thread_start More...
void | logsys_blackbox_set (int enable)
void | logsys_blackbox_prefork (void)
void | logsys_blackbox_postfork (void)
cs_error_t | logsys_reopen_log_files (void)

## Macro Definition Documentation

## IPC_LOGSYS_SIZE

#define IPC_LOGSYS_SIZE 8192*1024

Definition at line 80 of file logsys.c.

## LOGSYS_LOGGER_INIT_DONE

#define LOGSYS_LOGGER_INIT_DONE 0

Definition at line 102 of file logsys.c.

## LOGSYS_LOGGER_NEEDS_INIT

#define LOGSYS_LOGGER_NEEDS_INIT 1

Definition at line 103 of file logsys.c.

## MAX_FILES_PER_SUBSYS

#define MAX_FILES_PER_SUBSYS 32

Definition at line 76 of file logsys.c.

## Function Documentation

## _logsys_config_subsys_get()

int _logsys_config_subsys_get | ( | const char * | subsys | ) |

_logsys_config_subsys_get

Parameters

  subsys |

Returns

Definition at line 469 of file logsys.c.

Referenced by logsys_config_mode_get().

## _logsys_subsys_create()

int _logsys_subsys_create | ( | const char * | subsys,
|  | const char * | filename
| ) |  |

_logsys_subsys_create

Parameters

  subsys |
  filename |

Returns

Definition at line 435 of file logsys.c.

References LOGSYS_MAX_SUBSYS_NAMELEN, and logsys_logger::subsys.

Referenced by _logsys_system_setup().

## _logsys_system_setup()

int _logsys_system_setup | ( | const char * | mainsystem,
|  | unsigned int | mode,
|  | int | syslog_facility,
|  | int | syslog_priority
| ) |  |

_logsys_system_setup

Parameters

  mainsystem |
  mode |
  syslog_facility |
  syslog_priority |

Returns

Definition at line 304 of file logsys.c.

References _logsys_subsys_create(), and LOGSYS_MAX_SUBSYS_NAMELEN.

## logsys_blackbox_postfork()

void logsys_blackbox_postfork | ( | void |  | ) |

Definition at line 886 of file logsys.c.

## logsys_blackbox_prefork()

void logsys_blackbox_prefork | ( | void |  | ) |

Definition at line 880 of file logsys.c.

## logsys_blackbox_set()

void logsys_blackbox_set | ( | int | enable | ) |

Definition at line 866 of file logsys.c.

## logsys_config_apply()

void logsys_config_apply | ( | void |  | ) |

logsys_config_apply

Definition at line 792 of file logsys.c.

## logsys_config_debug_set()

int logsys_config_debug_set | ( | const char * | subsys,
|  | unsigned int | value
| ) |  |

enabling debug, disable message priority filtering.

everything is sent everywhere. priority values for file and syslog are not overwritten.

Parameters

  subsys |
  value |

Returns

Definition at line 806 of file logsys.c.

## logsys_config_file_set()

int logsys_config_file_set | ( | const char * | subsys,
|  | const char ** | error_string,
|  | const char * | file
| ) |  |

to close a logfile, just invoke this function with a NULL file or if you want to change logfile, the old one will be closed for you.

Parameters

  subsys |
  error_string |
  file |

Returns

Definition at line 539 of file logsys.c.

## logsys_config_logfile_priority_set()

int logsys_config_logfile_priority_set | ( | const char * | subsys,
|  | unsigned int | priority
| ) |  |

logsys_config_logfile_priority_set

Parameters

  subsys |
  priority |

Returns

Definition at line 691 of file logsys.c.

## logsys_config_mode_get()

unsigned int logsys_config_mode_get | ( | const char * | subsys | ) |

logsys_config_mode_get

Parameters

  subsys |

Returns

Definition at line 527 of file logsys.c.

References _logsys_config_subsys_get(), and logsys_logger::subsys.

## logsys_config_mode_set()

int logsys_config_mode_set | ( | const char * | subsys,
|  | unsigned int | mode
| ) |  |

logsys_config_mode_set

Parameters

  subsys |
  mode |

Returns

Definition at line 505 of file logsys.c.

## logsys_config_syslog_facility_set()

int logsys_config_syslog_facility_set | ( | const char * | subsys,
|  | unsigned int | facility
| ) |  |

per system/subsystem settings.

NOTE: once a subsystem is created and configured, changing the default does NOT affect the subsystems.

Pass a NULL subsystem to change them all

Parameters

  subsys |
  facility |

Returns

Definition at line 657 of file logsys.c.

## logsys_config_syslog_priority_set()

int logsys_config_syslog_priority_set | ( | const char * | subsys,
|  | unsigned int | priority
| ) |  |

logsys_config_syslog_priority_set

Parameters

  subsys |
  priority |

Returns

Definition at line 664 of file logsys.c.

## logsys_format_get()

char* logsys_format_get | ( | void |  | ) |

logsys_format_get

Returns

Definition at line 652 of file logsys.c.

## logsys_format_set()

int logsys_format_set | ( | const char * | format | ) |

configuration bits that can only be done for the whole system

Parameters

  format |

Returns

Definition at line 593 of file logsys.c.

## logsys_priority_id_get()

int logsys_priority_id_get | ( | const char * | name | ) |

logsys_priority_id_get

Parameters

  name |

Returns

Definition at line 832 of file logsys.c.

## logsys_reopen_log_files()

cs_error_t logsys_reopen_log_files | ( | void |  | ) |

Definition at line 892 of file logsys.c.

References CS_OK.

## logsys_system_fini()

void logsys_system_fini | ( | void |  | ) |

logsys_system_fini

Definition at line 286 of file logsys.c.

References LOGSYS_MAX_SUBSYS_COUNT.

Referenced by _corosync_exit_error().

## logsys_thread_start()

int logsys_thread_start | ( | void |  | ) |

logsys_thread_start

Returns

Definition at line 844 of file logsys.c.

References LOGSYS_MAX_SUBSYS_COUNT.