Class: Agoo::ErrorStream
- Inherits:
-
Object
- Object
- Agoo::ErrorStream
- Defined in:
- ext/agoo/error_stream.c,
ext/agoo/error_stream.c
Overview
Used in a reqquest as the rack.errors attribute. Writing to the stream and flushing will make an error log entry.
Instance Method Summary collapse
-
#flush ⇒ Object
call-seq: flush().
-
#puts(str) ⇒ Object
call-seq: puts(str).
-
#write(str) ⇒ Object
call-seq: write(str).
Instance Method Details
#flush ⇒ Object
call-seq: flush()
Flushs the accumulated text in the stream as an error log entry.
70 71 72 73 74 75 76 77 78 |
# File 'ext/agoo/error_stream.c', line 70 static VALUE es_flush(VALUE self) { ErrorStream es = (ErrorStream)DATA_PTR(self); log_cat(&es->server->error_cat, "%s", es->text->text); es->text->len = 0; return self; } |
#puts(str) ⇒ Object
call-seq: puts(str)
Write the str to the stream along with a newline character, accumulating it until flush is called.
38 39 40 41 42 43 44 45 46 |
# File 'ext/agoo/error_stream.c', line 38 static VALUE es_puts(VALUE self, VALUE str) { ErrorStream es = (ErrorStream)DATA_PTR(self); es->text = text_append(es->text, StringValuePtr(str), (int)RSTRING_LEN(str)); es->text = text_append(es->text, "\n", 1); return Qnil; } |
#write(str) ⇒ Object
call-seq: write(str)
Write the str to the stream, accumulating it until flush is called.
54 55 56 57 58 59 60 61 62 |
# File 'ext/agoo/error_stream.c', line 54 static VALUE es_write(VALUE self, VALUE str) { ErrorStream es = (ErrorStream)DATA_PTR(self); int cnt = (int)RSTRING_LEN(str); es->text = text_append(es->text, StringValuePtr(str), cnt); return INT2NUM(cnt); } |