logdna-rails 0.0.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +15 -59
- data/.gitignore +0 -11
- data/.rspec +0 -2
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -21
- data/README.md +0 -113
- data/Rakefile +0 -6
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/lib/logdna/rails.rb +0 -19
- data/logdna-rails.gemspec +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11213205c83286528992bb3ff2fa03af78f179a4
|
4
|
+
data.tar.gz: 55e6835da1b56dcbd535e9b48a0ed9443608a7ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b853af8bdf17a1af599673c111f213e23cda65a11863e5bb644561b971febb0bd7e717a489b054f8d6657d6891943940efff361aee79403bf45a468e2342a75
|
7
|
+
data.tar.gz: 9773764115391c3b147834f141fa3609579a2eccc9fa0222bd102cc7fc787fb02e41c18850f3f8d9f1c7bfd08a4d9f8a1204b7fe12a71499cf18ee464aeb5056
|
metadata
CHANGED
@@ -1,63 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logdna-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Gun Woo Choi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: http
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '2.0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '2.0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: activesupport
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '4.0'
|
34
|
-
- - "<"
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: '6.0'
|
37
|
-
type: :runtime
|
38
|
-
prerelease: false
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
40
|
-
requirements:
|
41
|
-
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: '4.0'
|
44
|
-
- - "<"
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '6.0'
|
47
13
|
- !ruby/object:Gem::Dependency
|
48
14
|
name: logdna
|
49
15
|
requirement: !ruby/object:Gem::Requirement
|
50
16
|
requirements:
|
51
17
|
- - "~>"
|
52
18
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
19
|
+
version: 1.0.7
|
54
20
|
type: :runtime
|
55
21
|
prerelease: false
|
56
22
|
version_requirements: !ruby/object:Gem::Requirement
|
57
23
|
requirements:
|
58
24
|
- - "~>"
|
59
25
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
26
|
+
version: 1.0.7
|
61
27
|
- !ruby/object:Gem::Dependency
|
62
28
|
name: bundler
|
63
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -78,59 +44,49 @@ dependencies:
|
|
78
44
|
requirements:
|
79
45
|
- - "~>"
|
80
46
|
- !ruby/object:Gem::Version
|
81
|
-
version: '10.
|
47
|
+
version: '10.5'
|
82
48
|
type: :development
|
83
49
|
prerelease: false
|
84
50
|
version_requirements: !ruby/object:Gem::Requirement
|
85
51
|
requirements:
|
86
52
|
- - "~>"
|
87
53
|
- !ruby/object:Gem::Version
|
88
|
-
version: '10.
|
54
|
+
version: '10.5'
|
89
55
|
- !ruby/object:Gem::Dependency
|
90
56
|
name: rspec
|
91
57
|
requirement: !ruby/object:Gem::Requirement
|
92
58
|
requirements:
|
93
59
|
- - "~>"
|
94
60
|
- !ruby/object:Gem::Version
|
95
|
-
version: '3.
|
61
|
+
version: '3.5'
|
96
62
|
type: :development
|
97
63
|
prerelease: false
|
98
64
|
version_requirements: !ruby/object:Gem::Requirement
|
99
65
|
requirements:
|
100
66
|
- - "~>"
|
101
67
|
- !ruby/object:Gem::Version
|
102
|
-
version: '3.
|
68
|
+
version: '3.5'
|
103
69
|
- !ruby/object:Gem::Dependency
|
104
70
|
name: webmock
|
105
71
|
requirement: !ruby/object:Gem::Requirement
|
106
72
|
requirements:
|
107
73
|
- - "~>"
|
108
74
|
- !ruby/object:Gem::Version
|
109
|
-
version: '2.
|
75
|
+
version: '2.3'
|
110
76
|
type: :development
|
111
77
|
prerelease: false
|
112
78
|
version_requirements: !ruby/object:Gem::Requirement
|
113
79
|
requirements:
|
114
80
|
- - "~>"
|
115
81
|
- !ruby/object:Gem::Version
|
116
|
-
version: '2.
|
82
|
+
version: '2.3'
|
117
83
|
description:
|
118
|
-
email:
|
84
|
+
email: matt.choi@logdna.com
|
119
85
|
executables: []
|
120
86
|
extensions: []
|
121
87
|
extra_rdoc_files: []
|
122
|
-
files:
|
123
|
-
|
124
|
-
- ".rspec"
|
125
|
-
- Gemfile
|
126
|
-
- LICENSE.txt
|
127
|
-
- README.md
|
128
|
-
- Rakefile
|
129
|
-
- bin/console
|
130
|
-
- bin/setup
|
131
|
-
- lib/logdna/rails.rb
|
132
|
-
- logdna-rails.gemspec
|
133
|
-
homepage: http://github.com/logdna/rails
|
88
|
+
files: []
|
89
|
+
homepage: https://github.com/logdna/rails
|
134
90
|
licenses:
|
135
91
|
- MIT
|
136
92
|
metadata: {}
|
@@ -153,5 +109,5 @@ rubyforge_project:
|
|
153
109
|
rubygems_version: 2.6.11
|
154
110
|
signing_key:
|
155
111
|
specification_version: 4
|
156
|
-
summary:
|
112
|
+
summary: LogDNA Rails Logger
|
157
113
|
test_files: []
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/Gemfile
DELETED
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2016 edwin-lai
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,113 +0,0 @@
|
|
1
|
-
<p align="center">
|
2
|
-
<a href="https://app.logdna.com">
|
3
|
-
<img height="95" width="201" src="https://raw.githubusercontent.com/logdna/artwork/master/logo%2Bruby.png">
|
4
|
-
</a>
|
5
|
-
<p align="center">Rails logger plugin for logging to <a href="https://app.logdna.com">LogDNA</a></p>
|
6
|
-
</p>
|
7
|
-
|
8
|
-
---
|
9
|
-
|
10
|
-
* **[Overview](#overview)**
|
11
|
-
* **[Installation](#installation)**
|
12
|
-
* **[API](#api)**
|
13
|
-
* **[Development](#development)**
|
14
|
-
* **[Contributing](#contributing)**
|
15
|
-
* **[License](#license)**
|
16
|
-
|
17
|
-
# Overview
|
18
|
-
|
19
|
-
This gem contains LogDNA::RailsLogger, a plugin for ActiveSupport::Logger from Rails.
|
20
|
-
|
21
|
-
# Installation
|
22
|
-
|
23
|
-
Add this line to your application's Gemfile:
|
24
|
-
|
25
|
-
```ruby
|
26
|
-
gem 'logdna-rails'
|
27
|
-
```
|
28
|
-
|
29
|
-
And then execute:
|
30
|
-
|
31
|
-
$ bundle
|
32
|
-
|
33
|
-
Or install it yourself as:
|
34
|
-
|
35
|
-
$ gem install logdna-rails
|
36
|
-
|
37
|
-
# Quick Setup
|
38
|
-
|
39
|
-
After installation, call
|
40
|
-
|
41
|
-
logger = LogDNA::RailsLogger.new(your_api_key, hostname)
|
42
|
-
|
43
|
-
to set up the logger.
|
44
|
-
|
45
|
-
To send logs, use exactly like the logger from the Ruby standard library. For example:
|
46
|
-
|
47
|
-
require 'logdna'
|
48
|
-
|
49
|
-
logger = LogDNA::RailsLogger.new(your_api_key, hostname)
|
50
|
-
|
51
|
-
logger.debug("Created logger")
|
52
|
-
logger.info("Program started")
|
53
|
-
logger.warn("Nothing to do!")
|
54
|
-
|
55
|
-
path = "a_non_existent_file"
|
56
|
-
|
57
|
-
begin
|
58
|
-
File.foreach(path) do |line|
|
59
|
-
unless line =~ /^(\w+) = (.*)$/
|
60
|
-
logger.error("Line in wrong format: #{line.chomp}")
|
61
|
-
end
|
62
|
-
end
|
63
|
-
rescue => err
|
64
|
-
logger.fatal("Caught exception; exiting")
|
65
|
-
logger.fatal(err)
|
66
|
-
end
|
67
|
-
|
68
|
-
# API
|
69
|
-
|
70
|
-
## ::new(api_key, hostname, options = {})
|
71
|
-
|
72
|
-
Instantiates a new instance of the class it is called on. api_key and hostname are required.
|
73
|
-
|
74
|
-
Options:
|
75
|
-
* logdev: The log device. This is a filename (String) or IO object (e.g. STDOUT, STDERR, an open file). Default: STDOUT.
|
76
|
-
* mac: MAC address. Default: nil.
|
77
|
-
* ip: IP address. Default: nil.
|
78
|
-
* default_app: Set a default app for this instance of the logger. Note that this can be overwritten by the progname below on the line level, as the app is a line attribute.
|
79
|
-
* environment: Alias for default_app.
|
80
|
-
|
81
|
-
__Make sure that the following options are numbers if you supply them. We are not responsible for any type errors if you enter non-numerical values for these options.__
|
82
|
-
|
83
|
-
* shift_age: Number of old log files to keep, or frequency of rotation (daily, weekly, or monthly). Default: 7
|
84
|
-
* shift_size: Maximum logfile size (only applies when shift_age is a number). Default: 1,048,576
|
85
|
-
* buffer_max_size: Maximum number of lines in buffer. Default: 10
|
86
|
-
* buffer_timeout: Frequency of posting requests to LogDNA. Default: 10 (seconds)
|
87
|
-
|
88
|
-
## \#add(severity, message=nil, progname=nil) {...}
|
89
|
-
|
90
|
-
Log a message if the given severity is high enough and post it to the LogDNA ingester. This is the generic logging method. Users will be more inclined to use debug, info, warn, error, and fatal (which all call \#add), as [described in the Ruby Logger documentation](https://ruby-doc.org/stdlib-2.3.0/libdoc/logger/rdoc/Logger.html). Note that these methods take a source as the argument and a block which returns a message. It returns the http response.
|
91
|
-
|
92
|
-
Note that the Rails logger documentation is located [here](http://api.rubyonrails.org/classes/ActiveSupport/Logger.html), but it's not very helpful.
|
93
|
-
|
94
|
-
## \#close_http
|
95
|
-
|
96
|
-
Close the HTTP connection to LogDNA's ingester.
|
97
|
-
|
98
|
-
## \#reopen_http
|
99
|
-
|
100
|
-
Open another HTTP connection to LogDNA's ingester if the connection is already closed.
|
101
|
-
|
102
|
-
# Development
|
103
|
-
|
104
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
105
|
-
|
106
|
-
# Contributing
|
107
|
-
|
108
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/logdna/ruby.
|
109
|
-
|
110
|
-
# License
|
111
|
-
|
112
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
113
|
-
|
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "logdna/rails"
|
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
|
data/bin/setup
DELETED
data/lib/logdna/rails.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'http'
|
2
|
-
require 'active_support/logger'
|
3
|
-
require 'logdna'
|
4
|
-
|
5
|
-
module LogDNA
|
6
|
-
class RailsLogger < ActiveSupport::Logger
|
7
|
-
include LogDNA
|
8
|
-
|
9
|
-
attr_reader :open
|
10
|
-
attr_accessor :api_key, :host, :default_app, :ip, :mac
|
11
|
-
|
12
|
-
def initialize(api_key, hostname, options = {})
|
13
|
-
@conn = HTTP.persistent LogDNA::INGESTER_DOMAIN
|
14
|
-
opts = fill_opts_with_defaults(options)
|
15
|
-
super(opts[:logdev], opts[:shift_age], opts[:shift_size])
|
16
|
-
set_ivars(api_key, hostname, options)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
data/logdna-rails.gemspec
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = 'logdna-rails'
|
7
|
-
spec.version = '0.0.5'
|
8
|
-
spec.author = 'Edwin Lai'
|
9
|
-
spec.email = 'edwin@logdna.com'
|
10
|
-
|
11
|
-
spec.summary = 'ActiveSupport::Logger plugin for LogDNA'
|
12
|
-
spec.homepage = 'http://github.com/logdna/rails'
|
13
|
-
spec.license = 'MIT'
|
14
|
-
|
15
|
-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
16
|
-
f.match(%r{^(test|spec|features)/})
|
17
|
-
end
|
18
|
-
spec.bindir = 'exe'
|
19
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
-
spec.require_paths = ['lib']
|
21
|
-
|
22
|
-
spec.add_runtime_dependency 'http', '~> 2.0'
|
23
|
-
spec.add_runtime_dependency 'activesupport', '>= 4.0', '< 6.0'
|
24
|
-
spec.add_runtime_dependency 'logdna', '~> 0.0.8'
|
25
|
-
|
26
|
-
spec.add_development_dependency 'bundler', '~> 1.13'
|
27
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
28
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
29
|
-
spec.add_development_dependency 'webmock', '~> 2.1'
|
30
|
-
end
|