class Onyx::SQL::Repository::Logger::IO

Overview

Logs anything followed by time elapsed by the block run into the specified IO.

logger = Onyx::SQL::Repository::Logger::IO.new(STDOUT)

result = logger.wrap("SELECT * FROM users") do
  db.query("SELECT * FROM users")
end

# => SELECT * FROM users
# => 501μs

Defined in:

onyx-sql/repository/logger/io.cr

Constructors

Instance Method Summary

Instance methods inherited from class Onyx::SQL::Repository::Logger

wrap(data_to_log : String, &block) wrap

Constructor Detail

def self.new(io : ::IO, colors = true) #

[View source]

Instance Method Detail

def wrap(data_to_log : String, &block) #

Wrap a block, logging elapsed time and returning the result.


[View source]