Class: Gat::LogEntry
- Inherits:
-
Object
- Object
- Gat::LogEntry
- Defined in:
- lib/gat/logger.rb
Instance Attribute Summary collapse
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#global_type ⇒ Object
readonly
Returns the value of attribute global_type.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
-
#verbose_level ⇒ Object
readonly
Returns the value of attribute verbose_level.
Instance Method Summary collapse
-
#initialize(logger, global_type = "trace", category = "undefined", message = "Empty", *options) ⇒ LogEntry
constructor
A new instance of LogEntry.
- #inspect ⇒ Object
- #output ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(logger, global_type = "trace", category = "undefined", message = "Empty", *options) ⇒ LogEntry
Returns a new instance of LogEntry.
189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/gat/logger.rb', line 189 def initialize(logger, global_type = "trace", category = "undefined", = "Empty", *) @logger = logger @time = Time.now @global_type = global_type unless logger.global_types.keys.include?(global_type) raise GatgetException.new("Undefined log global_type #{ global_type }", "initialize_log_entry") end @category = category @message = @options = @verbose_level = logger.global_types[global_type]['verbose'] end |
Instance Attribute Details
#category ⇒ Object (readonly)
Returns the value of attribute category.
182 183 184 |
# File 'lib/gat/logger.rb', line 182 def category @category end |
#global_type ⇒ Object (readonly)
Returns the value of attribute global_type.
181 182 183 |
# File 'lib/gat/logger.rb', line 181 def global_type @global_type end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
180 181 182 |
# File 'lib/gat/logger.rb', line 180 def logger @logger end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
183 184 185 |
# File 'lib/gat/logger.rb', line 183 def @message end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
184 185 186 |
# File 'lib/gat/logger.rb', line 184 def @options end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
186 187 188 |
# File 'lib/gat/logger.rb', line 186 def time @time end |
#verbose_level ⇒ Object (readonly)
Returns the value of attribute verbose_level.
185 186 187 |
# File 'lib/gat/logger.rb', line 185 def verbose_level @verbose_level end |
Instance Method Details
#inspect ⇒ Object
205 206 207 |
# File 'lib/gat/logger.rb', line 205 def inspect "#{ self.time.strftime("%Y-%m-%d %H:%M:%S") } | #{ self.global_type.ljust(20) } | #{ self.category.ljust(20) } => #{ self. }" end |
#output ⇒ Object
213 214 215 |
# File 'lib/gat/logger.rb', line 213 def output self. end |
#to_hash ⇒ Object
209 210 211 |
# File 'lib/gat/logger.rb', line 209 def to_hash { 'time' => self.time, 'global_type' => self.global_type, 'category' => self.category, 'message' => self., 'options' => self. } end |