Ruby 1.9.2p136(2010-12-25revision30365)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Defines | Functions | Variables

# ext/syslog/syslog.c File Reference

`#include "ruby/ruby.h"`
`#include "ruby/util.h"`
`#include <syslog.h>`
Include dependency graph for syslog.c:

Go to the source code of this file.

## Defines
#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

## Define 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 188 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 232 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 40 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 121 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 126 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 111 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 163 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 183 of file syslog.c.

Referenced by Init_syslog().

static VALUE mSyslog_isopen | ( | VALUE | self | ) | `[static]`

Definition at line 106 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 143 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 57 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 116 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 99 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 131 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 221 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 226 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 21 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 15 of file syslog.c.

Referenced by Init_syslog().

VALUE mSyslogConstants

Definition at line 15 of file syslog.c.

Referenced by Init_syslog().

int syslog_facility = -1

Definition at line 17 of file syslog.c.

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

const char* syslog_ident = NULL`[static]`

Definition at line 16 of file syslog.c.

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

int syslog_mask = -1

Definition at line 17 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 18 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 17 of file syslog.c.

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