Skip to content

Commit

Permalink
Removing the default logging initializing to give you the ability to …
Browse files Browse the repository at this point in the history
…decide when it's enabled. Fixes #966 (#967)
  • Loading branch information
jwoertink authored Sep 12, 2023
1 parent f84e111 commit 17ccff0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions spec/spec_helper.cr
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ backend = Log::IOBackend.new(STDERR)
backend.formatter = Dexter::JSONLogFormatter.proc
Log.builder.bind("avram.*", :error, backend)

Avram.initialize_logging

Db::Create.new(quiet: true).run_task
Db::Migrate.new(quiet: true).run_task
Db::VerifyConnection.new(quiet: true).run_task
Expand Down
5 changes: 3 additions & 2 deletions src/avram.cr
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ module Avram

alias TableName = String | Symbol

# This subscribes to several `Pulsar` events.
# These events are triggered during query and
# operation events
def self.initialize_logging
Avram::Events::QueryEvent.subscribe do |event, duration|
next if event.query.starts_with?("TRUNCATE")
Expand Down Expand Up @@ -85,5 +88,3 @@ module Avram
end
end
end

Avram.initialize_logging

0 comments on commit 17ccff0

Please sign in to comment.