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.
166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/smplkit/logging/models.rb', line 166 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.
163 164 165 |
# File 'lib/smplkit/logging/models.rb', line 163 def created_at @created_at end |
#description ⇒ Object
Returns the value of attribute description.
163 164 165 |
# File 'lib/smplkit/logging/models.rb', line 163 def description @description end |
#environments ⇒ Object
Returns the value of attribute environments.
163 164 165 |
# File 'lib/smplkit/logging/models.rb', line 163 def environments @environments end |
#id ⇒ Object
Returns the value of attribute id.
163 164 165 |
# File 'lib/smplkit/logging/models.rb', line 163 def id @id end |
#key ⇒ Object
Returns the value of attribute key.
163 164 165 |
# File 'lib/smplkit/logging/models.rb', line 163 def key @key end |
#level ⇒ Object
Returns the value of attribute level.
163 164 165 |
# File 'lib/smplkit/logging/models.rb', line 163 def level @level end |
#name ⇒ Object
Returns the value of attribute name.
163 164 165 |
# File 'lib/smplkit/logging/models.rb', line 163 def name @name end |
#parent_id ⇒ Object
Returns the value of attribute parent_id.
163 164 165 |
# File 'lib/smplkit/logging/models.rb', line 163 def parent_id @parent_id end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
163 164 165 |
# File 'lib/smplkit/logging/models.rb', line 163 def updated_at @updated_at end |
Instance Method Details
#_apply(other) ⇒ Object
202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/smplkit/logging/models.rb', line 202 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!
195 196 197 198 199 |
# File 'lib/smplkit/logging/models.rb', line 195 def delete raise "SmplLogGroup was constructed without a client; cannot delete" if @client.nil? @client.delete(@key) end |
#save ⇒ Object Also known as: save!
181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/smplkit/logging/models.rb', line 181 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 |