staccato 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +14 -0
- data/lib/staccato/adapter/logger.rb +25 -0
- data/lib/staccato/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e9fb805954cebe8f6334573603ad141a54a0799
|
4
|
+
data.tar.gz: 40489db42cf2874a45a22ada4232d2c84b618ac9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d606349f6b90ffa8e2c96c072f3549311daf437c74ad6b97216c3d720ca0c384cc0850c32862817a49b751e88b79250a986ba02f641cdf305576ea0de0df130b
|
7
|
+
data.tar.gz: 5d1d3ccc1000191700ee1b3559fa5db18e24c60b4098f5633bb8851444275827584e1e1dfe692c78573a70cff22a0ec2b047b08ae6934d1eb5de22de4ea70a51
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -504,6 +504,20 @@ end
|
|
504
504
|
|
505
505
|
Be sure to set the ip or host and port to wherever you have configured Staccato::Proxy to run.
|
506
506
|
|
507
|
+
### Logger Adapter for Local Development/Debugging ###
|
508
|
+
|
509
|
+
If you're running in development and simply want to make sure Staccato is being called where you expect it to be. Or, if you want to compare the parameters staccato sends with the Google Analytics documentation.
|
510
|
+
|
511
|
+
```ruby
|
512
|
+
tracker = Staccato.tracker('UA-XXXX-Y') do |c|
|
513
|
+
c.adapter = Staccato::Adapter::Logger.new(Stacatto.ga_collection_uri, Logger.new(STDOUT), lambda {|params| JSON.dump(params)})
|
514
|
+
end
|
515
|
+
```
|
516
|
+
|
517
|
+
If you would prefer to log to a file (default is STDOUT), you can pass in an instance of a Logger (from Ruby's stdlib) or anything that responds to `debug`.
|
518
|
+
|
519
|
+
If you would like to format the params hash as something other than `k=v` in your logs, you can pass in anything that responds to `call` and format as a string. The default should be consumable by Splunk and other logging software.
|
520
|
+
|
507
521
|
## Contributing ##
|
508
522
|
|
509
523
|
1. Fork it
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'logger'
|
2
|
+
|
3
|
+
module Staccato
|
4
|
+
module Adapter
|
5
|
+
class Logger # The Ruby HTTP Library Adapter
|
6
|
+
DEFAULT_FORMATTER = lambda {|params| params.map {|k,v| [k,v].join('=')}.join(' ')}
|
7
|
+
|
8
|
+
def initialize(uri, logger = nil, formatter = nil)
|
9
|
+
@uri = uri
|
10
|
+
|
11
|
+
@logger = logger || Logger.new(STDOUT)
|
12
|
+
@formatter = formatter || default_formatter
|
13
|
+
end
|
14
|
+
|
15
|
+
def post(params)
|
16
|
+
@logger.debug(@formatter.call(params))
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
def default_formatter
|
21
|
+
DEFAULT_FORMATTER
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/staccato/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: staccato
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Pitale
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -114,6 +114,7 @@ files:
|
|
114
114
|
- lib/staccato.rb
|
115
115
|
- lib/staccato/adapter/faraday.rb
|
116
116
|
- lib/staccato/adapter/http.rb
|
117
|
+
- lib/staccato/adapter/logger.rb
|
117
118
|
- lib/staccato/adapter/net_http.rb
|
118
119
|
- lib/staccato/adapter/udp.rb
|
119
120
|
- lib/staccato/adapter/validate.rb
|