stackify-ruby-logging 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +41 -0
- data/LICENSE.md +62 -0
- data/README.md +93 -0
- data/Rakefile +6 -0
- data/lib/logging/appenders/stackify.rb +38 -0
- data/lib/logging/plugins/stackify.rb +15 -0
- data/lib/logging/stackify-ruby-logging.rb +8 -0
- data/lib/logging/stackify_ruby_logging/version.rb +5 -0
- data/stackify-ruby-logging.gemspec +28 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ef27d23139a5d77ae5748f4e2767e909eb16acc1
|
4
|
+
data.tar.gz: a96afa19dda182aa2142005a819147176a62281b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 432abc2a6b37ccbd643050c3798c5cb67c21666a1c846fcf64d9d0f42a8b1dd4ff3334c93893593ba8e2a7ae5b546a95eb4ced7715e2670d8114e6a980bfdd61
|
7
|
+
data.tar.gz: 6da9de5bdd93afee4dd41b8d33dd73081fd0bd02b9c8b98912e6da0ac5ee9685cfd634cf7eda4eb4d255b253bfa02d93a0af5df45e5a7800aaa59ac080ea15bc
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
stackify-ruby-logging (1.0.0)
|
5
|
+
stackify-api-ruby (~> 1.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
diff-lcs (1.3)
|
11
|
+
faraday (0.15.4)
|
12
|
+
multipart-post (>= 1.2, < 3)
|
13
|
+
multipart-post (2.0.0)
|
14
|
+
rake (10.5.0)
|
15
|
+
rspec (3.8.0)
|
16
|
+
rspec-core (~> 3.8.0)
|
17
|
+
rspec-expectations (~> 3.8.0)
|
18
|
+
rspec-mocks (~> 3.8.0)
|
19
|
+
rspec-core (3.8.0)
|
20
|
+
rspec-support (~> 3.8.0)
|
21
|
+
rspec-expectations (3.8.2)
|
22
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
23
|
+
rspec-support (~> 3.8.0)
|
24
|
+
rspec-mocks (3.8.0)
|
25
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
26
|
+
rspec-support (~> 3.8.0)
|
27
|
+
rspec-support (3.8.0)
|
28
|
+
stackify-api-ruby (1.0.12)
|
29
|
+
faraday (~> 0.8)
|
30
|
+
|
31
|
+
PLATFORMS
|
32
|
+
ruby
|
33
|
+
|
34
|
+
DEPENDENCIES
|
35
|
+
bundler (~> 1.17)
|
36
|
+
rake (~> 10.0)
|
37
|
+
rspec (~> 3.0)
|
38
|
+
stackify-ruby-logging!
|
39
|
+
|
40
|
+
BUNDLED WITH
|
41
|
+
1.17.3
|
data/LICENSE.md
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
Stackify Ruby Logging LICENSE
|
2
|
+
---
|
3
|
+
|
4
|
+
Certain inventions disclosed in this file may be claimed within patents owned or patent applications filed by
|
5
|
+
Stackify, LLC (“Stackify”) or third parties.
|
6
|
+
|
7
|
+
Stackify grants you a revocable, non-exclusive, non-transferable, limited license to download, install and use this
|
8
|
+
Stackify Ruby Logging package (“Application”) strictly in accordance with the terms of this Agreement and the terms found
|
9
|
+
at https://stackify.com/terms-conditions.
|
10
|
+
|
11
|
+
You agree not to, and you will not permit others to: license, sell, rent, lease, assign, distribute, transmit, host,
|
12
|
+
outsource, disclose or otherwise commercially exploit the Application or make the Application available to any third
|
13
|
+
party; modify, make derivative works of, disassemble, decrypt, reverse compile or reverse engineer any part of the
|
14
|
+
Application; or remove, alter or obscure any proprietary notice (including any notice of copyright or trademark) of
|
15
|
+
Stackify or its affiliates, partners, suppliers or the licensors of the Application.
|
16
|
+
|
17
|
+
You may install, execute, and distribute these files and their contents only in conjunction with your direct use of
|
18
|
+
Stackify’s services. These files and their contents shall not be used in conjunction with any other product or
|
19
|
+
software, including but not limited to those that may compete with any Stackify product, feature, or software. As a
|
20
|
+
condition to the foregoing grant, you must provide this notice along with each copy you distribute and you must not
|
21
|
+
remove, alter, or obscure this notice.
|
22
|
+
|
23
|
+
The Application, including without limitation all copyrights, patents, trademarks, trade secrets and other intellectual
|
24
|
+
property rights are, and shall remain, the sole and exclusive property of Stackify. Any feedback, comments, ideas,
|
25
|
+
code, pull requests, improvements or suggestions (collectively, "Suggestions") provided by you to Stackify with respect
|
26
|
+
to the Application shall remain the sole and exclusive property of Stackify. Stackify shall be free to use, copy,
|
27
|
+
modify, publish, or redistribute the Suggestions for any purpose and in any way without any credit or any compensation
|
28
|
+
to you.
|
29
|
+
|
30
|
+
Stackify reserves the right to modify, suspend or discontinue, temporarily or permanently, the Application or any
|
31
|
+
service to which it connects, with or without notice and without liability to you.
|
32
|
+
|
33
|
+
Stackify may from time to time provide enhancements or improvements to the features/functionality of the Application,
|
34
|
+
which may include patches, bug fixes, updates, upgrades and other modifications ("Updates"). Updates may modify or
|
35
|
+
delete certain features and/or functionalities of the Application. You agree that Stackify has no obligation to (i)
|
36
|
+
provide any Updates, or (ii) continue to provide or enable any particular features and/or functionalities of the
|
37
|
+
Application to you. You further agree that all Updates will be (i) deemed to constitute an integral part of the
|
38
|
+
Application, and (ii) subject to the terms and conditions of this Agreement.
|
39
|
+
|
40
|
+
All other use, reproduction, modification, distribution, or other exploitation of these files is strictly prohibited,
|
41
|
+
except as may be set forth in a separate written license agreement between you and Stackify. The terms of any such
|
42
|
+
license agreement will control over this notice. The license stated above will be automatically terminated and
|
43
|
+
revoked if you exceed its scope or violate any of the terms of this notice.
|
44
|
+
|
45
|
+
Upon termination of this Agreement, you shall cease all use of the Application and delete all copies of the
|
46
|
+
Application from your mobile device or from your computer.
|
47
|
+
|
48
|
+
Termination of this Agreement will not limit any of Stackify LLC's rights or remedies at law or in equity in case of
|
49
|
+
breach by you (during the term of this Agreement) of any of your obligations under the present Agreement.
|
50
|
+
|
51
|
+
You agree to indemnify and hold Stackify LLC and its parents, subsidiaries, affiliates, officers, employees, agents,
|
52
|
+
partners and licensors (if any) harmless from any claim or demand, including reasonable attorneys' fees, due to or
|
53
|
+
arising out of your: (a) use of the Application; (b) violation of this Agreement or any law or regulation; or (c)
|
54
|
+
violation of any right of a third party.
|
55
|
+
|
56
|
+
Unless otherwise expressly agreed by Stackify in a separate written license agreement, these files are provided
|
57
|
+
AS IS, WITHOUT WARRANTY OF ANY KIND, including without any implied warranties of MERCHANTABILITY, FITNESS FOR A
|
58
|
+
PARTICULAR PURPOSE, TITLE, or NON-INFRINGEMENT. As a condition to your use of these files, you are solely responsible
|
59
|
+
for such use. Stackify will have no liability to you for direct, indirect, consequential, incidental, special, or
|
60
|
+
punitive damages or for lost profits or data.
|
61
|
+
|
62
|
+
|
data/README.md
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
# stackify-ruby-logging
|
2
|
+
|
3
|
+
Logging handler for sending log messages and exceptions to Stackify. Logging >=2.0.0 <2.2.2 is supported.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```
|
10
|
+
gem 'logging'
|
11
|
+
gem 'stackify-ruby-logging'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
```
|
16
|
+
$ bundle install
|
17
|
+
```
|
18
|
+
## Note
|
19
|
+
This stackify-ruby-logging gem will work and tested for the following Ruby versions:
|
20
|
+
2.1.x, 2.3.x, 2.4.x, 2.5.x
|
21
|
+
However this gem won't work in ruby version such as 1.9.x/2.0.x.
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
### Rails
|
25
|
+
If your application is based on Rails you will add the script below in config/application.rb. For example:
|
26
|
+
```
|
27
|
+
module SampleRailsApp
|
28
|
+
class Application < Rails::Application
|
29
|
+
# Initialize configuration defaults for originally generated Rails version.
|
30
|
+
config.load_defaults 5.2
|
31
|
+
...
|
32
|
+
Other code goes here...
|
33
|
+
...
|
34
|
+
require 'logging'
|
35
|
+
Logging.init
|
36
|
+
|
37
|
+
logger = Logging.logger['sample_logger']
|
38
|
+
logger = Stackify::LoggerProxy.new(logger)
|
39
|
+
logger.add_appenders \
|
40
|
+
Logging.appenders.stdout, # output log messages to stdout, you can remove this line if you don't want to display to stdout
|
41
|
+
Logging.appenders.file(File.join('log', 'development.log')), # output log messages to a log file
|
42
|
+
Logging.appenders.stackify( # output log messages to Stackify
|
43
|
+
:api_key => '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
44
|
+
:app_name => 'rails-app',
|
45
|
+
:environment => :development,
|
46
|
+
:log_level => :info
|
47
|
+
)
|
48
|
+
config.logger = logger
|
49
|
+
end
|
50
|
+
end
|
51
|
+
```
|
52
|
+
|
53
|
+
### Non-Rails
|
54
|
+
For using stackify-ruby-logging gem within any Ruby application such as Sinatra add to top of your main file:
|
55
|
+
```
|
56
|
+
require 'logging'
|
57
|
+
Logging.init
|
58
|
+
|
59
|
+
logger = Logging.logger['sample_logger']
|
60
|
+
logger = Stackify::LoggerProxy.new(logger)
|
61
|
+
logger.add_appenders \
|
62
|
+
Logging.appenders.stdout,
|
63
|
+
Logging.appenders.file(File.join('log', 'development.log')),
|
64
|
+
Logging.appenders.stackify(
|
65
|
+
:api_key => '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
66
|
+
:app_name => 'sinatra-app',
|
67
|
+
:environment => :development,
|
68
|
+
:log_level => :info
|
69
|
+
)
|
70
|
+
```
|
71
|
+
|
72
|
+
### Log level
|
73
|
+
You can use the following log levels: :info, :debug, :warn, :error & :fatal.
|
74
|
+
|
75
|
+
## Troubleshooting
|
76
|
+
If there are problems, you can enable internal logging of the stackify-ruby-logging. Add debug_log option see the example below:
|
77
|
+
```
|
78
|
+
require 'logging'
|
79
|
+
Logging.init
|
80
|
+
|
81
|
+
logger = Logging.logger['sample_logger']
|
82
|
+
logger = Stackify::LoggerProxy.new(logger)
|
83
|
+
logger.add_appenders \
|
84
|
+
Logging.appenders.stdout,
|
85
|
+
Logging.appenders.file(File.join('log', 'development.log')),
|
86
|
+
Logging.appenders.stackify(
|
87
|
+
:api_key => '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
88
|
+
:app_name => 'sinatra-app',
|
89
|
+
:environment => :development,
|
90
|
+
:log_level => :info,
|
91
|
+
:debug_log => File.join('log', 'stackify.log')
|
92
|
+
)
|
93
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'stackify-api-ruby'
|
2
|
+
|
3
|
+
module Logging
|
4
|
+
module Appenders
|
5
|
+
def self.stackify(*args)
|
6
|
+
return ::Logging::Appenders::StackifyRubyLogging if args.empty?
|
7
|
+
::Logging::Appenders::StackifyRubyLogging.new(*args)
|
8
|
+
end
|
9
|
+
|
10
|
+
class StackifyRubyLogging < ::Logging::Appender
|
11
|
+
def initialize(opts = {})
|
12
|
+
super(opts[:app_name], opts)
|
13
|
+
logger = ::Logger.new(opts[:debug_log])
|
14
|
+
version_190 = '1.9.0'
|
15
|
+
version_200 = '2.0.0'
|
16
|
+
if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new(version_190) ||
|
17
|
+
Gem::Version.new(RUBY_VERSION) <= Gem::Version.new(version_200)
|
18
|
+
error_msg = 'Error: stackify-ruby-logging gem is currently not compatible in ruby version 1.9.x/2.0.x'
|
19
|
+
puts error_msg
|
20
|
+
logger.error error_msg
|
21
|
+
else
|
22
|
+
# Setup the configuration for stackify-api-ruby
|
23
|
+
if defined? Stackify
|
24
|
+
Stackify.setup do |config|
|
25
|
+
config.api_key = opts[:api_key]
|
26
|
+
config.env = opts[:environment] || :development
|
27
|
+
config.app_name = opts[:app_name] || 'default'
|
28
|
+
config.log_level = opts[:log_level] || :debug
|
29
|
+
config.mode = :logging
|
30
|
+
config.logger = logger
|
31
|
+
end
|
32
|
+
Stackify.run
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Logging
|
2
|
+
module Plugins
|
3
|
+
module Stackify
|
4
|
+
extend self
|
5
|
+
|
6
|
+
VERSION = '1.0.0'.freeze
|
7
|
+
|
8
|
+
# This method will be called by the Logging framework when it first
|
9
|
+
# initializes. Here we require the stackify appender code.
|
10
|
+
def initialize_stackify
|
11
|
+
require File.expand_path('../../appenders/stackify', __FILE__)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "logging/stackify_ruby_logging/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "stackify-ruby-logging"
|
8
|
+
spec.version = Logging::StackifyRubyLogging::VERSION
|
9
|
+
spec.authors = ['Stackify']
|
10
|
+
spec.email = ['support@stackify.com']
|
11
|
+
spec.summary = 'Stackify Ruby Logging'
|
12
|
+
spec.homepage = 'http://www.stackify.com'
|
13
|
+
spec.license = 'Stackify'
|
14
|
+
|
15
|
+
# Specify which files should be added to the gem when it is released.
|
16
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
17
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
18
|
+
`git ls-files -z`.split("\x0").reject { |f| 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_development_dependency "bundler", "~> 1.17"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
27
|
+
spec.add_runtime_dependency 'stackify-api-ruby', '~> 1.0'
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: stackify-ruby-logging
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stackify
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-02-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.17'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.17'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: stackify-api-ruby
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.0'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- support@stackify.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".travis.yml"
|
79
|
+
- Gemfile
|
80
|
+
- Gemfile.lock
|
81
|
+
- LICENSE.md
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- lib/logging/appenders/stackify.rb
|
85
|
+
- lib/logging/plugins/stackify.rb
|
86
|
+
- lib/logging/stackify-ruby-logging.rb
|
87
|
+
- lib/logging/stackify_ruby_logging/version.rb
|
88
|
+
- stackify-ruby-logging.gemspec
|
89
|
+
homepage: http://www.stackify.com
|
90
|
+
licenses:
|
91
|
+
- Stackify
|
92
|
+
metadata: {}
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
requirements: []
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 2.5.2.3
|
110
|
+
signing_key:
|
111
|
+
specification_version: 4
|
112
|
+
summary: Stackify Ruby Logging
|
113
|
+
test_files: []
|