context_logger 0.0.41 → 0.0.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9e008c70f4b8407833f42781545288f463f8548c
4
- data.tar.gz: 5000f4aa5737e905897335d477c5be28c26a581b
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YjA0ODA0YWU3NTk2YTE0YjgxYzMxMTczMDZiY2MxY2Q4Yzg1OTUzZA==
5
+ data.tar.gz: !binary |-
6
+ N2RiOTFhOWZiZjM3OTY2YzA1ZTY2MmZhMTE5YzQ5NjhjYTRkN2U2Yw==
5
7
  SHA512:
6
- metadata.gz: 154b8a1a7f637ab0de78dddf8849d5f486693c53fa28acc5bf0f28b9caf8bfeeffed8c3e2bc42a5a6fe411a02590021bdec43889d96f7786280b25df9a1f3b97
7
- data.tar.gz: 9ea923cca2ed01ed09df2bf33655f23b35225f3967408cd738bd5cf39e62e04c8759c45f66fe90b5d6d9f8efdc8c8f94821f007dc4a4c2a864aac9f3ec1f31cb
8
+ metadata.gz: !binary |-
9
+ ODdlYjJhNWM4ODJjZTA5ZGEzNmRkN2NiMzE1MzdmYjYzNmUyMTY4MTcxNGZm
10
+ NWFkMTEwNzY4ZTI5MmZiZjdiM2E1ODEzMjJmNDVjNzY3ZGVmMjNkYzA4MGMw
11
+ MTc3MGQ5NmFkNDM1NjI5YzU1ZTcwNmViY2Y0ZGQ5NWM2ZjY2MDU=
12
+ data.tar.gz: !binary |-
13
+ ZGVjMDk3YTg2OWMxODhmYjNmN2QzZDI0MDYzYjNhY2VkYmQ0YjEwZWVhOTgy
14
+ ZDcxM2ExMTU0NDUzNDcyYTY5MDA0ODhjNzJjMTYzYTU2MjI5ZmJiMjE4OTkz
15
+ NjhjYWQwYTc0NDI0NTBkNmQwMTU5NDVmYmI0YzNiODFlMzM3NTE=
data/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # context_logger
2
+ ## Setup
3
+ In your Gemfile add:
4
+ ```
5
+ gem 'context_logger'
6
+ ```
7
+ ## Setting destinations
8
+ In your config file (e.g. config/environment.rb) add
9
+ ```
10
+ ContextLogger.set_destinations(:all)
11
+ ```
12
+ To configure logging distination replace :all with any subset of:
13
+ ```
14
+ {
15
+ write_rails_log: true,
16
+ write_context_log: true,
17
+ write_db_log: true
18
+ }
19
+ ```
20
+ e.g. if you want to exclude logging to DB:
21
+ ```
22
+ ContextLogger.set_destinations({
23
+ write_rails_log: true,
24
+ write_context_log: true
25
+ })
26
+ ```
27
+ ## Setting up the options (default values)
28
+ Instead of passing the values that don't change often (e.g. server, ), it's possible to set them using setup method:
29
+ ```
30
+ ContextLogger.setup({context: :publish, action_id: 1, server: 'myserver.com'})
31
+ ```
32
+ It's possible to overid them anytime.
33
+ To see current value of options, just call:
34
+ ```
35
+ ContextLogger.options
36
+ ```
37
+ ## Logging
38
+ ContextLogger exposes the following methods for logging:
39
+ :info, :warn, :error, :debug, :fatal
40
+ And here are the params (with defaults):
41
+ ```
42
+ message, method, params, stack_trace=nil, action_id=nil, context=nil ,server=nil
43
+ ```
44
+ An example of logging a warning message:
45
+ ```
46
+ ContextLogger.warn('Just another message', :store_data, {data:{a:1, b:2}}, "'Range.detach' is now a no-op, as per DOM (http://dom.spec.whatwg.org/#dom-range-detach).", 1)
47
+ ```
48
+ ## HTTP API:
49
+ In order to write the log also to db_log, you should set it using set_destination method:
50
+ ```
51
+ ContextLogger.set_destinations({
52
+ ...
53
+ write_db_log: true,
54
+ ...
55
+ })
56
+ ```
57
+ The log entries from the DB are available via HTTP API:
58
+
59
+ http://server_name/api/v1/resources/context_logger
data/config/routes.rb CHANGED
@@ -2,7 +2,7 @@ Rails.application.routes.draw do
2
2
  namespace :api do
3
3
  namespace :v1 do
4
4
  namespace :resources do
5
- resources :context_logger, only: [:index]
5
+ resources :context_loggers, only: [:index]
6
6
  end
7
7
  end
8
8
  end
@@ -1,15 +1,13 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'context_logger'
3
- s.version = '0.0.41'
3
+ s.version = '0.0.44'
4
4
  s.date = '2015-11-11'
5
- s.summary = 'writes log to db and log file and exposes it via http'
6
- s.description = 'writes log to db and log file and exposes it via http'
5
+ s.summary = 'Writes log by context'
6
+ s.description = 'Writes log to db and log files (configurable destinations) according the context and exposes the log entries via http'
7
7
  s.authors = ['Alexander Libster']
8
8
  s.email = '012alex012@gmail.com'
9
9
  s.files = `git ls-files`.split($/)
10
- # s.files = %w(lib/context_logger.rb lib/context_logger/engine.rb db/migrate/20151112164817_create_context_logs.rb
11
- # app/models/context_log.rb app/controllers/api/v1/resources/context_logger_controller.rb config/routes.rb)
12
- s.homepage = ''
10
+ s.homepage = 'https://github.com/Natural-Intelligence/context_logger'
13
11
  s.license = 'MIT'
14
12
 
15
13
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: context_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.41
4
+ version: 0.0.44
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Libster
@@ -10,7 +10,8 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2015-11-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: writes log to db and log file and exposes it via http
13
+ description: Writes log to db and log files (configurable destinations) according
14
+ the context and exposes the log entries via http
14
15
  email: 012alex012@gmail.com
15
16
  executables: []
16
17
  extensions: []
@@ -18,6 +19,7 @@ extra_rdoc_files: []
18
19
  files:
19
20
  - Gemfile
20
21
  - Gemfile.lock
22
+ - README.md
21
23
  - app/controllers/api/v1/resources/context_logger_controller.rb
22
24
  - app/models/context_log.rb
23
25
  - config/routes.rb
@@ -32,7 +34,7 @@ files:
32
34
  - spec/rails_helper.rb
33
35
  - spec/rails_stub.rb
34
36
  - spec/spec_helper.rb
35
- homepage: ''
37
+ homepage: https://github.com/Natural-Intelligence/context_logger
36
38
  licenses:
37
39
  - MIT
38
40
  metadata: {}
@@ -42,18 +44,18 @@ require_paths:
42
44
  - lib
43
45
  required_ruby_version: !ruby/object:Gem::Requirement
44
46
  requirements:
45
- - - ">="
47
+ - - ! '>='
46
48
  - !ruby/object:Gem::Version
47
49
  version: '0'
48
50
  required_rubygems_version: !ruby/object:Gem::Requirement
49
51
  requirements:
50
- - - ">="
52
+ - - ! '>='
51
53
  - !ruby/object:Gem::Version
52
54
  version: '0'
53
55
  requirements: []
54
56
  rubyforge_project:
55
- rubygems_version: 2.2.2
57
+ rubygems_version: 2.4.6
56
58
  signing_key:
57
59
  specification_version: 4
58
- summary: writes log to db and log file and exposes it via http
60
+ summary: Writes log by context
59
61
  test_files: []