netatalk 4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
logger.h File Reference
`#include <limits.h>`
`#include <stdbool.h>`
`#include <stdio.h>`

Go to the source code of this file.

## Data Structures
struct | log_config_t
struct | logtype_conf_t

## Macros
#define | UAM_MODULE_EXPORT
#define | logoption_nsrcinfo 0x04
#define | logoption_pid 0x01
#define | logoption_cons 0x02
#define | logoption_ndelay 0x08
#define | logoption_perror 0x20
#define | logoption_nfile 0x40
#define | logoption_nline 0x80
#define | logfacility_user (1<<3)
#define | logfacility_mail (2<<3)
#define | logfacility_daemon (3<<3)
#define | logfacility_auth (4<<3)
#define | logfacility_syslog (5<<3)
#define | logfacility_lpr (6<<3)
#define | logfacility_authpriv (10<<3)
#define | logfacility_ftp (11<<3)
#define | LOG_MAX log_info
#define | LOG(log_level, type, ...)

## Enumerations
enum | loglevels { log_none , log_severe , log_error , log_warning , log_note , log_info , log_debug , log_debug6 , log_debug7 , log_debug8 , log_debug9 , log_maxdebug }
enum | logtypes { logtype_default , logtype_logger , logtype_cnid , logtype_afpd , logtype_dsi , logtype_atalkd , logtype_papd , logtype_uams , logtype_fce , logtype_ad , logtype_sl , logtype_end_of_list_marker }

## Functions
void | setuplog (const char *loglevel, const char *logfile, const bool log_us_timestamp)
void | set_processname (const char *processname)
void | syslog_setup (int loglevel, enum logtypes logtypelogtype, int display_options, int facility)
UAM_MODULE_EXPORT void | make_log_entry (enum loglevels loglevel, enum logtypes logtypelogtype, const char *file, const bool log_us_timestamp, int line, char *message,...)

## Variables
log_config_t | log_config
UAM_MODULE_EXPORT logtype_conf_t | type_configs [logtype_end_of_list_marker]

## Macro Definition Documentation

## ◆ LOG

#define LOG | ( |  | log_level,
|  |  | type,
|  |  | ... )

Value:
do { \
if (log_level <= type_configs[type].level) \
make_log_entry((log_level), (type), __FILE__, type_configs[type].timestamp_us, __LINE__, __VA_ARGS__); \
} while(0)
type_configs
UAM_MODULE_EXPORT logtype_conf_t type_configs[logtype_end_of_list_marker]
Definition logger.c:90
type
static enum op type
Definition nad_cp.c:96

## ◆ LOG_MAX

#define LOG_MAX log_info

## ◆ logfacility_auth

#define logfacility_auth (4<<3)

security/authorization messages

## ◆ logfacility_authpriv

#define logfacility_authpriv (10<<3)

security/auth messages (private)

## ◆ logfacility_daemon

#define logfacility_daemon (3<<3)

system daemons

## ◆ logfacility_ftp

#define logfacility_ftp (11<<3)

ftp daemon

## ◆ logfacility_lpr

#define logfacility_lpr (6<<3)

line printer subsystem

## ◆ logfacility_mail

#define logfacility_mail (2<<3)

mail system

## ◆ logfacility_syslog

#define logfacility_syslog (5<<3)

messages generated by syslogd

## ◆ logfacility_user

#define logfacility_user (1<<3)

random user-level messages

## ◆ logoption_cons

#define logoption_cons 0x02

log on the console if error logging

## ◆ logoption_ndelay

#define logoption_ndelay 0x08

don't delay open

## ◆ logoption_nfile

#define logoption_nfile 0x40

ignore the file that called the log

## ◆ logoption_nline

#define logoption_nline 0x80

ignore the line that called the log

## ◆ logoption_nsrcinfo

#define logoption_nsrcinfo 0x04

don't log source info

## ◆ logoption_perror

#define logoption_perror 0x20

log to stderr as well

## ◆ logoption_pid

#define logoption_pid 0x01

log the pid with each message

## ◆ UAM_MODULE_EXPORT

#define UAM_MODULE_EXPORT

## Enumeration Type Documentation

## ◆ loglevels

enum loglevels

Enumerator
log_none |
log_severe |
log_error |
log_warning |
log_note |
log_info |
log_debug |
log_debug6 |
log_debug7 |
log_debug8 |
log_debug9 |
log_maxdebug |

## ◆ logtypes

enum logtypes

this is the enum specifying all availiable logtypes

Enumerator
logtype_default | default logtype, used when no other is specified
logtype_logger | general logger
logtype_cnid | catalog node id backends
logtype_afpd | apple filing protocol daemon
logtype_dsi | data stream interface layer
logtype_atalkd | appletalk daemon
logtype_papd | printer access protocol daemon
logtype_uams | user authentication modules
logtype_fce | filesystem change events
logtype_ad | appledouble
logtype_sl | spotlight
logtype_end_of_list_marker | don't put any logtypes after this

## Function Documentation

## ◆ make_log_entry()

UAM_MODULE_EXPORT void make_log_entry | ( | enum loglevels | loglevel,
|  | enum logtypes | logtype,
|  | const char * | file,
|  | const bool | log_us_timestamp,
|  | int | line,
|  | char * | message,
|  |  | ... )

LOG macro func no.1: log the message to file

Bug
  make_log_entry has 1 main flaw: The message in its entirety, must fit into the tempbuffer. So it must be shorter than MAXLOGSIZE

## ◆ set_processname()

void set_processname | ( | const char * | processname | ) |

This function sets up the processname

## ◆ setuplog()

void setuplog | ( | const char * | loglevel,
|  | const char * | logfile,
|  | const bool | log_us_timestamp )

## ◆ syslog_setup()

void syslog_setup | ( | int | loglevel,
|  | enum logtypes | logtype,
|  | int | display_options,
|  | int | facility )

Setup the level and type of log that will be logged to syslog.

Setup syslog logging

## Variable Documentation

## ◆ log_config

log_config_t log_config
| extern

Main log config container

## ◆ type_configs

UAM_MODULE_EXPORT logtype_conf_t type_configs[logtype_end_of_list_marker]
| extern