Module: Log

Defined in:
ext/actuator/log.cpp

Class Method Summary collapse

Class Method Details

.debug(message) ⇒ Object



28
29
30
31
32
# File 'ext/actuator/log.cpp', line 28

static VALUE Log_Debug(VALUE self, VALUE message)
{
    Log::Debug("%s", StringValueCStr(message));
    return Qnil;
}

.error(message) ⇒ Object



46
47
48
49
50
# File 'ext/actuator/log.cpp', line 46

static VALUE Log_Error(VALUE self, VALUE message)
{
    Log::Error("%s", StringValueCStr(message));
    return Qnil;
}

.file_path=(path) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'ext/actuator/log.cpp', line 52

static VALUE Log_SetFilePath(VALUE self, VALUE path)
{
    if (NIL_P(path)) {
        Log::log_file = 0;
    } else if (SYMBOL_P(path) && SYM2ID(path) == rb_intern("stdout")) {
        Log::log_file = stdout;
    } else if (RB_TYPE_P(path, T_STRING) && CLASS_OF(path) == rb_cString) {
        Log::log_file = fopen(RSTRING_PTR(path), "w");
    } else {
        rb_raise(rb_eRuntimeError, "path must be a string, :stdout or nil");
    }
    return Qnil;
}

.level=(level) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'ext/actuator/log.cpp', line 66

static VALUE Log_SetLevel(VALUE self, VALUE level)
{
    if (SYMBOL_P(level)) {
        if (SYM2ID(level) == rb_intern("debug")) {
            Level = LogLevel::Debug;
            return Qnil;
        }
        if (SYM2ID(level) == rb_intern("info")) {
            Level = LogLevel::Info;
            return Qnil;
        }
        if (SYM2ID(level) == rb_intern("warn")) {
            Level = LogLevel::Warn;
            return Qnil;
        }
        if (SYM2ID(level) == rb_intern("error")) {
            Level = LogLevel::Error;
            return Qnil;
        }
    }
    rb_raise(rb_eRuntimeError, "level must be :debug, :info, :warn or :error");
    return Qnil;
}

.puts(message) ⇒ Object



34
35
36
37
38
# File 'ext/actuator/log.cpp', line 34

static VALUE Log_Info(VALUE self, VALUE message)
{
    Log::Info("%s", StringValueCStr(message));
    return Qnil;
}

.warn(message) ⇒ Object



40
41
42
43
44
# File 'ext/actuator/log.cpp', line 40

static VALUE Log_Warn(VALUE self, VALUE message)
{
    Log::Warn("%s", StringValueCStr(message));
    return Qnil;
}