syslog.c File Reference
`#include "ruby/ruby.h"`
`#include "ruby/util.h"`
`#include <syslog.h>`

Go to the source code of this file.

## Macros

#define | define_syslog_shortcut_method(pri, name)
#define | rb_define_syslog_const(id) rb_define_const(mSyslogConstants, #id, INT2NUM(id))
#define | rb_define_syslog_shortcut(name) rb_define_module_function(mSyslog, #name, mSyslog_##name, -1)

## Functions

static void | syslog_write (int pri, int argc, VALUE *argv)
static VALUE | mSyslog_close (VALUE self)
static VALUE | mSyslog_open (int argc, VALUE *argv, VALUE self)
static VALUE | mSyslog_reopen (int argc, VALUE *argv, VALUE self)
static VALUE | mSyslog_isopen (VALUE self)
static VALUE | mSyslog_ident (VALUE self)
static VALUE | mSyslog_options (VALUE self)
static VALUE | mSyslog_facility (VALUE self)
static VALUE | mSyslog_get_mask (VALUE self)
static VALUE | mSyslog_set_mask (VALUE self, VALUE mask)
static VALUE | mSyslog_log (int argc, VALUE *argv, VALUE self)
static VALUE | mSyslog_inspect (VALUE self)
static VALUE | mSyslog_instance (VALUE self)
static VALUE | mSyslogConstants_LOG_MASK (VALUE klass, VALUE pri)
static VALUE | mSyslogConstants_LOG_UPTO (VALUE klass, VALUE pri)
void | Init_syslog ()

## Variables

static VALUE | mSyslog
static VALUE | mSyslogConstants
static const char * | syslog_ident = NULL
static int | syslog_options = -1
static int | syslog_facility = -1
static int | syslog_mask = -1
static int | syslog_opened = 0

## Macro Definition Documentation

#define define_syslog_shortcut_method | ( |  | pri,
|  |  | name
| ) |  |

Value:
static VALUE mSyslog_##name(int argc, VALUE *argv, VALUE self) \
{ \
syslog_write((pri), argc, argv); \
\
return self; \
}

Definition at line 341 of file syslog.c.

#define rb_define_syslog_const | ( |  | id | ) | rb_define_const(mSyslogConstants, #id, INT2NUM(id))

Referenced by Init_syslog().

#define rb_define_syslog_shortcut | ( |  | name | ) | rb_define_module_function(mSyslog, #name, mSyslog_##name, -1)

Referenced by Init_syslog().

## Function Documentation

void Init_syslog | ( |  | ) |

Definition at line 409 of file syslog.c.

References debug, err, mSyslog, mSyslog_close(), mSyslog_facility(), mSyslog_get_mask(), mSyslog_ident(), mSyslog_inspect(), mSyslog_instance(), mSyslog_isopen(), mSyslog_log(), mSyslog_open(), mSyslog_options(), mSyslog_reopen(), mSyslog_set_mask(), mSyslogConstants, mSyslogConstants_LOG_MASK(), mSyslogConstants_LOG_UPTO(), rb_define_module(), rb_define_module_function(), rb_define_module_under(), rb_define_syslog_const, rb_define_syslog_shortcut, and rb_include_module().

static VALUE mSyslog_close | ( | VALUE | self | ) |

static

Definition at line 43 of file syslog.c.

References free(), NULL, Qnil, rb_eRuntimeError, rb_raise(), rb_secure(), syslog_facility, syslog_ident, syslog_mask, syslog_opened, and syslog_options.

Referenced by Init_syslog(), mSyslog_open(), and mSyslog_reopen().

static VALUE mSyslog_facility | ( | VALUE | self | ) |

static

Definition at line 222 of file syslog.c.

References INT2NUM(), Qnil, syslog_facility, and syslog_opened.

Referenced by Init_syslog().

static VALUE mSyslog_get_mask | ( | VALUE | self | ) |

static

Definition at line 230 of file syslog.c.

References INT2NUM(), Qnil, syslog_mask, and syslog_opened.

Referenced by Init_syslog().

static VALUE mSyslog_ident | ( | VALUE | self | ) |

static

Definition at line 208 of file syslog.c.

References Qnil, rb_str_new2(), syslog_ident, and syslog_opened.

Referenced by Init_syslog().

static VALUE mSyslog_inspect | ( | VALUE | self | ) |

static

Definition at line 314 of file syslog.c.

References buf, rb_class2name(), rb_str_new2(), snprintf, syslog_facility, syslog_ident, syslog_mask, syslog_opened, and syslog_options.

Referenced by Init_syslog().

static VALUE mSyslog_instance | ( | VALUE | self | ) |

static

Definition at line 336 of file syslog.c.

Referenced by Init_syslog().

static VALUE mSyslog_isopen | ( | VALUE | self | ) |

static

Definition at line 201 of file syslog.c.

References Qfalse, Qtrue, and syslog_opened.

Referenced by Init_syslog().

static VALUE mSyslog_log | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |

static

Definition at line 292 of file syslog.c.

References CLASS_OF, FIX2INT, FIXNUM_P, rb_class2name(), rb_eArgError, rb_eTypeError, rb_raise(), and syslog_write().

Referenced by Init_syslog().

static VALUE mSyslog_open | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |

static

Definition at line 138 of file syslog.c.

References mSyslog_close(), NIL_P, NUM2INT, rb_block_given_p(), rb_ensure(), rb_eRuntimeError, rb_gv_get(), rb_raise(), rb_scan_args(), rb_yield(), RSTRING_PTR, SafeStringValue, strdup, syslog_facility, syslog_ident, syslog_mask, syslog_opened, and syslog_options.

Referenced by Init_syslog(), and mSyslog_reopen().

static VALUE mSyslog_options | ( | VALUE | self | ) |

static

Definition at line 215 of file syslog.c.

References INT2NUM(), Qnil, syslog_opened, and syslog_options.

Referenced by Init_syslog().

static VALUE mSyslog_reopen | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |

static

Definition at line 189 of file syslog.c.

References mSyslog_close(), and mSyslog_open().

Referenced by Init_syslog().

static VALUE mSyslog_set_mask | ( | VALUE | self,
|  | VALUE | mask
| ) |  |

static

Definition at line 250 of file syslog.c.

References NUM2INT, rb_eRuntimeError, rb_raise(), rb_secure(), syslog_mask, and syslog_opened.

Referenced by Init_syslog().

static VALUE mSyslogConstants_LOG_MASK | ( | VALUE | klass,
|  | VALUE | pri
| ) |  |

static

Definition at line 379 of file syslog.c.

References INT2FIX, and NUM2INT.

Referenced by Init_syslog().

static VALUE mSyslogConstants_LOG_UPTO | ( | VALUE | klass,
|  | VALUE | pri
| ) |  |

static

Definition at line 390 of file syslog.c.

References INT2FIX, and NUM2INT.

Referenced by Init_syslog().

static void syslog_write | ( | int | pri,
|  | int | argc,
|  | VALUE * | argv
| ) |  |

static

Definition at line 22 of file syslog.c.

References rb_eArgError, rb_eRuntimeError, rb_f_sprintf(), rb_raise(), rb_secure(), RSTRING_PTR, and syslog_opened.

Referenced by mSyslog_log().

## Variable Documentation

VALUE mSyslog

static

Definition at line 16 of file syslog.c.

Referenced by Init_syslog().

VALUE mSyslogConstants

static

Definition at line 16 of file syslog.c.

Referenced by Init_syslog().

int syslog_facility = -1

static

Definition at line 18 of file syslog.c.

Referenced by mSyslog_close(), mSyslog_facility(), mSyslog_inspect(), and mSyslog_open().

const char* syslog_ident = NULL

static

Definition at line 17 of file syslog.c.

Referenced by mSyslog_close(), mSyslog_ident(), mSyslog_inspect(), and mSyslog_open().

int syslog_mask = -1

static

Definition at line 18 of file syslog.c.

Referenced by mSyslog_close(), mSyslog_get_mask(), mSyslog_inspect(), mSyslog_open(), and mSyslog_set_mask().

int syslog_opened = 0

static

Definition at line 19 of file syslog.c.

Referenced by mSyslog_close(), mSyslog_facility(), mSyslog_get_mask(), mSyslog_ident(), mSyslog_inspect(), mSyslog_isopen(), mSyslog_open(), mSyslog_options(), mSyslog_set_mask(), and syslog_write().

int syslog_options = -1

static

Definition at line 18 of file syslog.c.

Referenced by mSyslog_close(), mSyslog_inspect(), mSyslog_open(), and mSyslog_options().