lib/neo4j/railtie.rb in neo4j-5.0.5 vs lib/neo4j/railtie.rb in neo4j-5.0.6

- old
+ new

@@ -70,16 +70,22 @@ def register_neo4j_cypher_logging return if @neo4j_cypher_logging_registered Neo4j::Server::CypherSession.log_with do |message| - puts message + (Neo4j::Config[:logger] || Rails.logger).info message end @neo4j_cypher_logging_registered = true end + console do + Neo4j::Config[:logger] = ActiveSupport::Logger.new(STDOUT) + + register_neo4j_cypher_logging + end + # Starting Neo after :load_config_initializers allows apps to # register migrations in config/initializers initializer 'neo4j.start', after: :load_config_initializers do |app| cfg = app.config.neo4j # Set Rails specific defaults @@ -88,13 +94,11 @@ cfg.sessions.each do |session_opts| Neo4j::Railtie.open_neo4j_session(session_opts) end Neo4j::Config.configuration.merge!(cfg.to_hash) - register_neo4j_cypher_logging if Neo4j::Config[:log_cypher_queries] - end + Neo4j::Config[:logger] ||= Rails.logger - console do register_neo4j_cypher_logging end end end