rails_json_logger 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6fdc2b705473822b4ae14159c1c723a7f5693e22
4
+ data.tar.gz: 7156ec7495aa72fd8b10697cc4fe8f4ecfaff8cc
5
+ SHA512:
6
+ metadata.gz: e04b6e23a879b303c5d0f5bf394e2203899c5bc1cbd7ff4f1ffe6a99496f61ee4df48a60d2d65776d57cfb46419e6b5f56c80c2813a1c748fb6c705e4946857c
7
+ data.tar.gz: 57fd89432dd14c84bbb86e6267567dcc80384abae76cf7183be4d16cf0cae4697d0b965ef87c785123029cc6c8da235d4573d09fab6a0060e1a72928e373d7af
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rails_json_logger.gemspec
4
+ gemspec
@@ -0,0 +1,36 @@
1
+ # RailsJsonLogger
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rails_json_logger`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'rails_json_logger'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install rails_json_logger
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rails_json_logger.
36
+
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "rails_json_logger"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,8 @@
1
+ require 'rails_semantic_logger'
2
+
3
+ require "rails_json_logger/version"
4
+ require "rails_json_logger/formatter"
5
+ require "rails_json_logger/railtie"
6
+
7
+ module RailsJsonLogger
8
+ end
@@ -0,0 +1,17 @@
1
+ module RailsJsonLogger
2
+ class Formatter < SemanticLogger::Formatters::Json
3
+ def initialize
4
+ super(time_format: :iso_8601, log_host: false, log_application: false, time_key: :timestamp)
5
+ end
6
+
7
+ def level
8
+ # skip :level_index
9
+ hash[:level] = log.level
10
+ end
11
+
12
+ def duration
13
+ # skip :duration as duration_human
14
+ hash[:duration] = log.duration if log.duration
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,10 @@
1
+ module RailsJsonLogger
2
+ class Railtie < Rails::Railtie
3
+ initializer 'rails_json_logger.initializer', group: :all do
4
+ config = Rails.application.config
5
+
6
+ config.rails_semantic_logger.add_file_appender = false
7
+ config.semantic_logger.add_appender(file_name: "log/#{Rails.env}.json", formatter: RailsJsonLogger::Formatter.new)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ module RailsJsonLogger
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rails_json_logger/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rails_json_logger"
8
+ spec.version = RailsJsonLogger::VERSION
9
+ spec.authors = ["Pablo Vizcay"]
10
+ spec.email = ["pablo.vizcay@gmail.com"]
11
+
12
+ spec.summary = 'Rails JSON Logger'
13
+ spec.description = 'Rails JSON Logger that depends on the semantic logger gem'
14
+ spec.homepage = 'https://github.com/vizcay/rails_json_logger'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_dependency "rails_semantic_logger", "~> 4.2", ">= 4.2.1"
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.14"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails_json_logger
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Pablo Vizcay
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-05-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails_semantic_logger
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.2'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 4.2.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '4.2'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 4.2.1
33
+ - !ruby/object:Gem::Dependency
34
+ name: bundler
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.14'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.14'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '10.0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '10.0'
61
+ description: Rails JSON Logger that depends on the semantic logger gem
62
+ email:
63
+ - pablo.vizcay@gmail.com
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files: []
67
+ files:
68
+ - ".gitignore"
69
+ - Gemfile
70
+ - README.md
71
+ - Rakefile
72
+ - bin/console
73
+ - bin/setup
74
+ - lib/rails_json_logger.rb
75
+ - lib/rails_json_logger/formatter.rb
76
+ - lib/rails_json_logger/railtie.rb
77
+ - lib/rails_json_logger/version.rb
78
+ - rails_json_logger.gemspec
79
+ homepage: https://github.com/vizcay/rails_json_logger
80
+ licenses:
81
+ - MIT
82
+ metadata: {}
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubyforge_project:
99
+ rubygems_version: 2.5.2
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: Rails JSON Logger
103
+ test_files: []