Module: Log
- Extended by:
- Comfort
- Defined in:
- lib/log.rb,
lib/log/file.rb,
lib/log/entry.rb,
lib/log/nolog.rb,
lib/log/fakeio.rb,
lib/log/comfort.rb,
lib/log/forward.rb,
lib/log/methods.rb,
lib/log/filereader.rb
Overview
Description
log/entry.rb provides some convenience methods in Log.
Synopsis
log(“Some info”) log(“Danger!”, :warn) warn(“Danger!”) debug(“mecode was here”)
Defined Under Namespace
Modules: Comfort, FakeIO, Methods Classes: Entry, File, FileReader, Forward, NoLog
Constant Summary collapse
- GroupSeparator =
"\x1d"
- RecordSeparator =
"\x1e"
- UnitSeparator =
"\x1f"
- RecordTerminator =
"\n"
- Printable =
currently unused
"%d#{RecordSeparator}%s#{RecordSeparator}%s#{RecordSeparator}%s"
- Serialized =
currently only used by Entry#serialize, but not by Entry::deserialize
"%d#{RecordSeparator}" \ "%s#{RecordSeparator}" \ "%s#{RecordSeparator}" \ "%s#{RecordSeparator}" \ "%s"
Instance Attribute Summary
Attributes included from Comfort
Class Method Summary collapse
-
.escape(data) ⇒ Object
escape binary data, the data will contain no n, r or t‘s after escaping, but still contain binary characters, but all of them preceeded by e.
-
.file(*args) ⇒ Object
Log.file is equivalent to Log::File.new.
-
.forward(*args) ⇒ Object
Log.forward is equivalent to Log::Forward.new.
-
.unescape(data) ⇒ Object
unescapes data escaped by Log.escape.
Methods included from Comfort
debug, error, exception, fail, info, log, warn
Class Method Details
.escape(data) ⇒ Object
escape binary data, the data will contain no n, r or t‘s after escaping, but still contain binary characters, but all of them preceeded by e
34 35 36 37 38 39 40 41 |
# File 'lib/log.rb', line 34 def self.escape(data) data. gsub(/\e/, "\e\e"). gsub(/\n/, "\en"). gsub(/\r/, "\er"). gsub(/\t/, "\et"). gsub(/[\x00-\x1a\x1c-\x1f]/, "\e\\0") end |
.file(*args) ⇒ Object
Log.file is equivalent to Log::File.new
17 18 19 |
# File 'lib/log/file.rb', line 17 def self.file(*args) Log::File.new(*args) end |
.forward(*args) ⇒ Object
Log.forward is equivalent to Log::Forward.new
16 17 18 |
# File 'lib/log/forward.rb', line 16 def self.forward(*args) Forward.new(*args) end |
.unescape(data) ⇒ Object
unescapes data escaped by Log.escape
44 45 46 47 48 49 50 |
# File 'lib/log.rb', line 44 def self.unescape(data) data. gsub(/\en/, "\n"). gsub(/\er/, "\r"). gsub(/\et/, "\t"). gsub(/\e(.)/, '\1') end |