Class: Smplkit::Logging::SmplLogGroup
- Inherits:
-
Object
- Object
- Smplkit::Logging::SmplLogGroup
- Defined in:
- lib/smplkit/logging/models.rb
Overview
A log group resource — a hierarchical bag of loggers with a shared configured level.
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#description ⇒ Object
Returns the value of attribute description.
-
#environments ⇒ Object
Returns the value of attribute environments.
-
#id ⇒ Object
Returns the value of attribute id.
-
#key ⇒ Object
Returns the value of attribute key.
-
#level ⇒ Object
Returns the value of attribute level.
-
#name ⇒ Object
Returns the value of attribute name.
-
#parent_id ⇒ Object
Returns the value of attribute parent_id.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Instance Method Summary collapse
- #_apply(other) ⇒ Object
- #delete ⇒ Object (also: #delete!)
-
#initialize(client = nil, key:, id: nil, name: nil, level: nil, description: nil, parent_id: nil, environments: nil, created_at: nil, updated_at: nil) ⇒ SmplLogGroup
constructor
A new instance of SmplLogGroup.
- #save ⇒ Object (also: #save!)
Constructor Details
#initialize(client = nil, key:, id: nil, name: nil, level: nil, description: nil, parent_id: nil, environments: nil, created_at: nil, updated_at: nil) ⇒ SmplLogGroup
Returns a new instance of SmplLogGroup.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/smplkit/logging/models.rb', line 75 def initialize(client = nil, key:, id: nil, name: nil, level: nil, description: nil, parent_id: nil, environments: nil, created_at: nil, updated_at: nil) @client = client @id = id @key = key @name = name @level = level @description = description @parent_id = parent_id @environments = environments || {} @created_at = created_at @updated_at = updated_at end |
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at.
72 73 74 |
# File 'lib/smplkit/logging/models.rb', line 72 def created_at @created_at end |
#description ⇒ Object
Returns the value of attribute description.
72 73 74 |
# File 'lib/smplkit/logging/models.rb', line 72 def description @description end |
#environments ⇒ Object
Returns the value of attribute environments.
72 73 74 |
# File 'lib/smplkit/logging/models.rb', line 72 def environments @environments end |
#id ⇒ Object
Returns the value of attribute id.
72 73 74 |
# File 'lib/smplkit/logging/models.rb', line 72 def id @id end |
#key ⇒ Object
Returns the value of attribute key.
72 73 74 |
# File 'lib/smplkit/logging/models.rb', line 72 def key @key end |
#level ⇒ Object
Returns the value of attribute level.
72 73 74 |
# File 'lib/smplkit/logging/models.rb', line 72 def level @level end |
#name ⇒ Object
Returns the value of attribute name.
72 73 74 |
# File 'lib/smplkit/logging/models.rb', line 72 def name @name end |
#parent_id ⇒ Object
Returns the value of attribute parent_id.
72 73 74 |
# File 'lib/smplkit/logging/models.rb', line 72 def parent_id @parent_id end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
72 73 74 |
# File 'lib/smplkit/logging/models.rb', line 72 def updated_at @updated_at end |
Instance Method Details
#_apply(other) ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/smplkit/logging/models.rb', line 111 def _apply(other) @id = other.id @key = other.key @name = other.name @level = other.level @description = other.description @parent_id = other.parent_id @environments = other.environments @created_at = other.created_at @updated_at = other.updated_at end |
#delete ⇒ Object Also known as: delete!
104 105 106 107 108 |
# File 'lib/smplkit/logging/models.rb', line 104 def delete raise "SmplLogGroup was constructed without a client; cannot delete" if @client.nil? @client.delete(@key) end |
#save ⇒ Object Also known as: save!
90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/smplkit/logging/models.rb', line 90 def save raise "SmplLogGroup was constructed without a client; cannot save" if @client.nil? updated = if @created_at.nil? @client._create_log_group(self) else @client._update_log_group(self) end _apply(updated) self end |