Browse Source

Log in development

master
Dylan Baker 3 years ago
parent
commit
bfc8cd2511
2 changed files with 4 additions and 1 deletions
  1. 1
    0
      .gitignore
  2. 3
    1
      db/connect.rb

+ 1
- 0
.gitignore View File

2
 vendor/
2
 vendor/
3
 web/public/*.css
3
 web/public/*.css
4
 web/public/*.js
4
 web/public/*.js
5
+db/log

+ 3
- 1
db/connect.rb View File

1
 require 'dotenv'
1
 require 'dotenv'
2
+require 'logger'
2
 
3
 
3
 Dotenv.load(File.expand_path('../.env'))
4
 Dotenv.load(File.expand_path('../.env'))
4
 
5
 
7
     adapter: :postgres,
8
     adapter: :postgres,
8
     database: ENV['DB_DATABASE'],
9
     database: ENV['DB_DATABASE'],
9
     user: ENV['DB_USERNAME'],
10
     user: ENV['DB_USERNAME'],
10
-    password: ENV['DB_PASSWORD']
11
+    password: ENV['DB_PASSWORD'],
12
+    logger: ENV['APP_ENV'] == 'development' ? Logger.new('db/log') : nil
11
   )
13
   )

Loading…
Cancel
Save