Class: Smplkit::Logging::SmplLogger
- Inherits:
-
Object
- Object
- Smplkit::Logging::SmplLogger
- Defined in:
- lib/smplkit/logging/models.rb
Overview
A logger resource managed by the smplkit Logging service.
Attributes:
- id, name: identity
- resolved_level: effective level computed by the platform from
environment overrides + log group inheritance
- level: explicit override (nil means inherit)
- service, environment: provenance
- log_group_id: parent log group, if any
- managed: whether the SDK should apply server-driven level changes
Instance Attribute Summary collapse
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#description ⇒ Object
Returns the value of attribute description.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#id ⇒ Object
Returns the value of attribute id.
-
#level ⇒ Object
Returns the value of attribute level.
-
#log_group_id ⇒ Object
Returns the value of attribute log_group_id.
-
#managed ⇒ Object
Returns the value of attribute managed.
-
#name ⇒ Object
Returns the value of attribute name.
-
#resolved_level ⇒ Object
Returns the value of attribute resolved_level.
-
#service ⇒ Object
Returns the value of attribute service.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Instance Method Summary collapse
- #_apply(other) ⇒ Object
- #delete ⇒ Object (also: #delete!)
-
#initialize(client = nil, name:, resolved_level:, id: nil, level: nil, service: nil, environment: nil, log_group_id: nil, managed: true, description: nil, created_at: nil, updated_at: nil) ⇒ SmplLogger
constructor
A new instance of SmplLogger.
- #managed? ⇒ Boolean
- #save ⇒ Object (also: #save!)
Constructor Details
#initialize(client = nil, name:, resolved_level:, id: nil, level: nil, service: nil, environment: nil, log_group_id: nil, managed: true, description: nil, created_at: nil, updated_at: nil) ⇒ SmplLogger
Returns a new instance of SmplLogger.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/smplkit/logging/models.rb', line 19 def initialize(client = nil, name:, resolved_level:, id: nil, level: nil, service: nil, environment: nil, log_group_id: nil, managed: true, description: nil, created_at: nil, updated_at: nil) @client = client @id = id @name = name @resolved_level = resolved_level @level = level @service = service @environment = environment @log_group_id = log_group_id @managed = managed @description = description @created_at = created_at @updated_at = updated_at end |
Instance Attribute Details
#created_at ⇒ Object
Returns the value of attribute created_at.
16 17 18 |
# File 'lib/smplkit/logging/models.rb', line 16 def created_at @created_at end |
#description ⇒ Object
Returns the value of attribute description.
16 17 18 |
# File 'lib/smplkit/logging/models.rb', line 16 def description @description end |
#environment ⇒ Object
Returns the value of attribute environment.
16 17 18 |
# File 'lib/smplkit/logging/models.rb', line 16 def environment @environment end |
#id ⇒ Object
Returns the value of attribute id.
16 17 18 |
# File 'lib/smplkit/logging/models.rb', line 16 def id @id end |
#level ⇒ Object
Returns the value of attribute level.
16 17 18 |
# File 'lib/smplkit/logging/models.rb', line 16 def level @level end |
#log_group_id ⇒ Object
Returns the value of attribute log_group_id.
16 17 18 |
# File 'lib/smplkit/logging/models.rb', line 16 def log_group_id @log_group_id end |
#managed ⇒ Object
Returns the value of attribute managed.
16 17 18 |
# File 'lib/smplkit/logging/models.rb', line 16 def managed @managed end |
#name ⇒ Object
Returns the value of attribute name.
16 17 18 |
# File 'lib/smplkit/logging/models.rb', line 16 def name @name end |
#resolved_level ⇒ Object
Returns the value of attribute resolved_level.
16 17 18 |
# File 'lib/smplkit/logging/models.rb', line 16 def resolved_level @resolved_level end |
#service ⇒ Object
Returns the value of attribute service.
16 17 18 |
# File 'lib/smplkit/logging/models.rb', line 16 def service @service end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
16 17 18 |
# File 'lib/smplkit/logging/models.rb', line 16 def updated_at @updated_at end |
Instance Method Details
#_apply(other) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/smplkit/logging/models.rb', line 54 def _apply(other) @id = other.id @name = other.name @resolved_level = other.resolved_level @level = other.level @service = other.service @environment = other.environment @log_group_id = other.log_group_id @managed = other.managed @description = other.description @created_at = other.created_at @updated_at = other.updated_at end |
#delete ⇒ Object Also known as: delete!
47 48 49 50 51 |
# File 'lib/smplkit/logging/models.rb', line 47 def delete raise "SmplLogger was constructed without a client; cannot delete" if @client.nil? @client.delete(@id || @name) end |
#managed? ⇒ Boolean
36 |
# File 'lib/smplkit/logging/models.rb', line 36 def managed? = !!@managed |
#save ⇒ Object Also known as: save!
38 39 40 41 42 43 44 |
# File 'lib/smplkit/logging/models.rb', line 38 def save raise "SmplLogger was constructed without a client; cannot save" if @client.nil? updated = @client._update_logger(self) _apply(updated) self end |