Class: LogStruct::Log::SQL
- Inherits:
-
T::Struct
- Object
- T::Struct
- LogStruct::Log::SQL
- Extended by:
- T::Sig
- Includes:
- Interfaces::AdditionalDataField, Interfaces::CommonFields, LogStruct::Log::Shared::MergeAdditionalDataFields, LogStruct::Log::Shared::SerializeCommon
- Defined in:
- lib/log_struct/log/sql.rb
Instance Attribute Summary collapse
-
#active_connections ⇒ Integer?
readonly
Returns the value of prop
active_connections. -
#adapter ⇒ String?
readonly
Returns the value of prop
adapter. -
#additional_data ⇒ Hash{String, Symbol => T.untyped}?
readonly
Returns the value of prop
additional_data. -
#bind_params ⇒ Array<T.untyped>?
readonly
Returns the value of prop
bind_params. -
#connection_pool_size ⇒ Integer?
readonly
Returns the value of prop
connection_pool_size. -
#database_name ⇒ String?
readonly
Returns the value of prop
database_name. -
#duration_ms ⇒ Float
readonly
Returns the value of prop
duration_ms. -
#event ⇒ Event
readonly
Returns the value of prop
event. -
#level ⇒ Level
readonly
Returns the value of prop
level. -
#message ⇒ String
readonly
Event-specific fields.
-
#name ⇒ String
readonly
Returns the value of prop
name. -
#operation_type ⇒ String?
readonly
Returns the value of prop
operation_type. -
#row_count ⇒ Integer?
readonly
Returns the value of prop
row_count. -
#source ⇒ Source::App
readonly
Shared/common fields.
-
#sql ⇒ String
readonly
Returns the value of prop
sql. -
#table_names ⇒ Array<String>?
readonly
Returns the value of prop
table_names. -
#timestamp ⇒ Time
readonly
Returns the value of prop
timestamp.
Instance Method Summary collapse
- #initialize(source: Source::App, event: Event::Database, timestamp:, level: Level::Info, message:, sql:, name:, duration_ms:, row_count: nil, adapter: nil, bind_params: nil, database_name: nil, connection_pool_size: nil, active_connections: nil, operation_type: nil, table_names: nil, additional_data: nil) ⇒ void constructor
- #to_h ⇒ Hash{LogStruct::LogField => T.untyped}
Methods included from LogStruct::Log::Shared::SerializeCommon
#as_json, #serialize, #serialize_common
Methods included from Interfaces::CommonFields
Methods included from LogStruct::Log::Shared::MergeAdditionalDataFields
Constructor Details
#initialize(source: Source::App, event: Event::Database, timestamp:, level: Level::Info, message:, sql:, name:, duration_ms:, row_count: nil, adapter: nil, bind_params: nil, database_name: nil, connection_pool_size: nil, active_connections: nil, operation_type: nil, table_names: nil, additional_data: nil) ⇒ void
|
|
# File '' const :source, Source::App, default: Source::App const :event, Event, default: Event::Database const :timestamp, Time, factory: -> { Time.now } const :level, Level, default: Level::Info const :message, String const :sql, String const :name, String const :duration_ms, Float const :row_count, T.nilable(Integer), default: nil const :adapter, T.nilable(String), default: nil const :bind_params, T.nilable(T::Array[T.untyped]), default: nil const :database_name, T.nilable(String), default: nil const :connection_pool_size, T.nilable(Integer), default: nil const :active_connections, T.nilable(Integer), default: nil const :operation_type, T.nilable(String), default: nil const :table_names, T.nilable(T::Array[String]), default: nil const :additional_data, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), default: nil |
Instance Attribute Details
#active_connections ⇒ Integer? (readonly)
Returns the value of prop active_connections.
|
|
# File '' const :active_connections, T.nilable(Integer), default: nil |
#adapter ⇒ String? (readonly)
Returns the value of prop adapter.
|
|
# File '' const :adapter, T.nilable(String), default: nil |
#additional_data ⇒ Hash{String, Symbol => T.untyped}? (readonly)
Returns the value of prop additional_data.
|
|
# File '' const :additional_data, T.nilable(T::Hash[T.any(String, Symbol), T.untyped]), default: nil |
#bind_params ⇒ Array<T.untyped>? (readonly)
Returns the value of prop bind_params.
|
|
# File '' const :bind_params, T.nilable(T::Array[T.untyped]), default: nil |
#connection_pool_size ⇒ Integer? (readonly)
Returns the value of prop connection_pool_size.
|
|
# File '' const :connection_pool_size, T.nilable(Integer), default: nil |
#database_name ⇒ String? (readonly)
Returns the value of prop database_name.
|
|
# File '' const :database_name, T.nilable(String), default: nil |
#duration_ms ⇒ Float (readonly)
Returns the value of prop duration_ms.
|
|
# File '' const :duration_ms, Float |
#event ⇒ Event (readonly)
Returns the value of prop event.
|
|
# File '' const :event, Event, default: Event::Database |
#level ⇒ Level (readonly)
Returns the value of prop level.
|
|
# File '' const :level, Level, default: Level::Info |
#message ⇒ String (readonly)
Event-specific fields
|
|
# File '' const :message, String |
#name ⇒ String (readonly)
Returns the value of prop name.
|
|
# File '' const :name, String |
#operation_type ⇒ String? (readonly)
Returns the value of prop operation_type.
|
|
# File '' const :operation_type, T.nilable(String), default: nil |
#row_count ⇒ Integer? (readonly)
Returns the value of prop row_count.
|
|
# File '' const :row_count, T.nilable(Integer), default: nil |
#source ⇒ Source::App (readonly)
Shared/common fields
|
|
# File '' const :source, Source::App, default: Source::App |
#sql ⇒ String (readonly)
Returns the value of prop sql.
|
|
# File '' const :sql, String |
#table_names ⇒ Array<String>? (readonly)
Returns the value of prop table_names.
|
|
# File '' const :table_names, T.nilable(T::Array[String]), default: nil |
#timestamp ⇒ Time (readonly)
Returns the value of prop timestamp.
|
|
# File '' const :timestamp, Time, factory: -> { Time.now } |
Instance Method Details
#to_h ⇒ Hash{LogStruct::LogField => T.untyped}
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/log_struct/log/sql.rb', line 55 def to_h h = T.let({}, T::Hash[LogStruct::LogField, T.untyped]) h[LogField::Message] = h[LogField::Sql] = sql h[LogField::Name] = name h[LogField::DurationMs] = duration_ms h[LogField::RowCount] = row_count unless row_count.nil? h[LogField::Adapter] = adapter unless adapter.nil? h[LogField::BindParams] = bind_params unless bind_params.nil? h[LogField::DatabaseName] = database_name unless database_name.nil? h[LogField::ConnectionPoolSize] = connection_pool_size unless connection_pool_size.nil? h[LogField::ActiveConnections] = active_connections unless active_connections.nil? h[LogField::OperationType] = operation_type unless operation_type.nil? h[LogField::TableNames] = table_names unless table_names.nil? h end |