Class: LogKernel::Event
- Inherits:
-
Object
- Object
- LogKernel::Event
- Includes:
- Level
- Defined in:
- lib/logutils/logger.rb
Constant Summary
Constants included from Level
Level::ALL, Level::DEBUG, Level::ERROR, Level::FATAL, Level::INFO, Level::OFF, Level::UNKNOWN, Level::WARN
Instance Attribute Summary collapse
-
#levelno ⇒ Object
readonly
Returns the value of attribute levelno.
-
#msg ⇒ Object
readonly
Returns the value of attribute msg.
-
#pid ⇒ Object
readonly
process_id.
-
#tid ⇒ Object
readonly
thread_id.
-
#ts ⇒ Object
readonly
timestamp.
Instance Method Summary collapse
- #error? ⇒ Boolean
- #fatal? ⇒ Boolean
-
#initialize(levelno, msg) ⇒ Event
constructor
A new instance of Event.
- #level ⇒ Object
- #to_s ⇒ Object
- #unknown? ⇒ Boolean
- #warn? ⇒ Boolean
Constructor Details
#initialize(levelno, msg) ⇒ Event
Returns a new instance of Event.
58 59 60 61 62 63 64 65 66 |
# File 'lib/logutils/logger.rb', line 58 def initialize( levelno, msg ) @levelno = levelno # pass in integer e.g. 0,1,2,3,etc. @msg = msg @pid = Process.pid @tid = Thread.current.object_id @ts = Time.now end |
Instance Attribute Details
#levelno ⇒ Object (readonly)
Returns the value of attribute levelno.
72 73 74 |
# File 'lib/logutils/logger.rb', line 72 def levelno @levelno end |
#msg ⇒ Object (readonly)
Returns the value of attribute msg.
73 74 75 |
# File 'lib/logutils/logger.rb', line 73 def msg @msg end |
#pid ⇒ Object (readonly)
process_id
74 75 76 |
# File 'lib/logutils/logger.rb', line 74 def pid @pid end |
#tid ⇒ Object (readonly)
thread_id
75 76 77 |
# File 'lib/logutils/logger.rb', line 75 def tid @tid end |
#ts ⇒ Object (readonly)
timestamp
76 77 78 |
# File 'lib/logutils/logger.rb', line 76 def ts @ts end |
Instance Method Details
#error? ⇒ Boolean
83 84 85 |
# File 'lib/logutils/logger.rb', line 83 def error? @levelno == ERROR end |
#fatal? ⇒ Boolean
79 80 81 |
# File 'lib/logutils/logger.rb', line 79 def fatal? @levelno == FATAL end |
#level ⇒ Object
68 69 70 |
# File 'lib/logutils/logger.rb', line 68 def level LEVEL_NAME[ @levelno ] end |
#to_s ⇒ Object
96 97 98 99 |
# File 'lib/logutils/logger.rb', line 96 def to_s # "[#{level}-#{pid}.#{tid}] #{msg}" "[#{level}] #{msg}" end |
#unknown? ⇒ Boolean
91 92 93 |
# File 'lib/logutils/logger.rb', line 91 def unknown? @levelno == UNKNOWN end |