Class: Datadog::Logging::Logger::UserFormatter
- Inherits:
-
Object
- Object
- Datadog::Logging::Logger::UserFormatter
- Defined in:
- lib/datadog/logging/logger.rb
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(user) ⇒ UserFormatter
constructor
A new instance of UserFormatter.
Constructor Details
#initialize(user) ⇒ UserFormatter
Returns a new instance of UserFormatter.
13 14 15 |
# File 'lib/datadog/logging/logger.rb', line 13 def initialize(user) @user = user end |
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
11 12 13 |
# File 'lib/datadog/logging/logger.rb', line 11 def user @user end |
Class Method Details
.call(user) ⇒ Object
30 31 32 |
# File 'lib/datadog/logging/logger.rb', line 30 def self.call(user) new(user).call end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/datadog/logging/logger.rb', line 17 def call base = { id: id, username: username, email: email, role: role } result = base.compact result.empty? ? nil : result end |