grape_logging 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb1521644b8ec276a0cd7eeb3cadcc75c98d88f5
4
- data.tar.gz: 815eaa0bf94e7f282ac99be2f0746ba31abdb4e2
3
+ metadata.gz: 7d165712d9c3331cabdf7c552804a46fbbe5fed5
4
+ data.tar.gz: eb1ba738d4a83adfe62f74f009f9fce746a37838
5
5
  SHA512:
6
- metadata.gz: 66614c057b039c188ed42a0058d178ffc128e2f3a04fa03e2df2c98558063f5161236f348251ca2aa7b03cabbc35a5894fcde074e2a8257121cbaf627bc92831
7
- data.tar.gz: 4af96b697baed8d4cb03d958133a18ad9ed66e7e601397330cd80960a19871c1c295b64de3c4d90b115ca6a23c6b4b3cc4bf7982ee6aa79812ee14a9fdf3f702
6
+ metadata.gz: ca5fe7a0e6caf93706dcd296a1b80288d2701eb41157fde6ead417a470f7f34a997a1f3503ee33e6020f78fa4bbbdcca4f87f678cd53e7cc2d59121cf96b9b35
7
+ data.tar.gz: 1d17d9f27d4b21d5bf327d08268a76dcb723640b802d795d7e1cff0bad2298c89f4ec2f11eca20cdc74af4f36a436cd2bf4ffa8b6fe67dee9c79ef4629fa5439
data/README.md CHANGED
@@ -78,6 +78,18 @@ log_file.sync = true
78
78
  logger Logger.new GrapeLogging::MultiIO.new(STDOUT, log_file)
79
79
  ```
80
80
 
81
+ ### Set the log level
82
+
83
+ You can control the level used to log. The default is `info`.
84
+
85
+ ```ruby
86
+ class MyAPI < Grape::API
87
+ use GrapeLogging::Middleware::RequestLogger,
88
+ logger: logger,
89
+ log_level: 'debug'
90
+ end
91
+ ```
92
+
81
93
  ### Logging via Rails instrumentation
82
94
 
83
95
  You can choose to not pass the logger to ```grape_logging``` but instead send logs to Rails instrumentation in order to let Rails and its configured Logger do the log job, for example.
@@ -16,7 +16,7 @@ module GrapeLogging
16
16
  @reporter = if options[:instrumentation_key]
17
17
  Reporters::ActiveSupportReporter.new(@options[:instrumentation_key])
18
18
  else
19
- Reporters::LoggerReporter.new(@options[:logger], @options[:formatter])
19
+ Reporters::LoggerReporter.new(@options[:logger], @options[:formatter], @options[:log_level])
20
20
  end
21
21
  end
22
22
 
@@ -1,14 +1,15 @@
1
1
  module Reporters
2
2
  class LoggerReporter
3
- def initialize(logger, formatter)
3
+ def initialize(logger, formatter, log_level)
4
4
  @logger = logger || Logger.new(STDOUT)
5
+ @log_level = log_level || :info
5
6
  if @logger.respond_to?(:formatter=)
6
7
  @logger.formatter = formatter || @logger.formatter || GrapeLogging::Formatters::Default.new
7
8
  end
8
9
  end
9
10
 
10
11
  def perform(params)
11
- @logger.info params
12
+ @logger.send(@log_level, params)
12
13
  end
13
14
  end
14
- end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module GrapeLogging
2
- VERSION = '1.4.0'
2
+ VERSION = '1.5.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape_logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - aserafin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-13 00:00:00.000000000 Z
11
+ date: 2017-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grape