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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e3af0bde415a8655877df36c7d4946b5b58783fa
4
- data.tar.gz: 72daad3c89d5e31a7a546c1881bb9a0b92eef036
3
+ metadata.gz: 2e9fb805954cebe8f6334573603ad141a54a0799
4
+ data.tar.gz: 40489db42cf2874a45a22ada4232d2c84b618ac9
5
5
  SHA512:
6
- metadata.gz: e370b94498361d9db18cc0acdbab16d81d7d9f458e88743f25f46febaa77b317337d5a0baf77b09c4b21d76d3388f4c5741c85c212ff4cc01a5498bd4034c3a1
7
- data.tar.gz: f9138d8bcbafc4c81007478493236c5182484a6721bb30cd994566f1fff2849b6851634e3d6e7361d46ae0300ab6dde349f52daec0d4d261204b2de930aa0c9a
6
+ metadata.gz: d606349f6b90ffa8e2c96c072f3549311daf437c74ad6b97216c3d720ca0c384cc0850c32862817a49b751e88b79250a986ba02f641cdf305576ea0de0df130b
7
+ data.tar.gz: 5d1d3ccc1000191700ee1b3559fa5db18e24c60b4098f5633bb8851444275827584e1e1dfe692c78573a70cff22a0ec2b047b08ae6934d1eb5de22de4ea70a51
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## Staccato 0.4.2 ##
2
+
3
+ * Logger adapter for development
4
+
5
+ *Tony Pitale <@tpitale>*
6
+
1
7
  ## Staccato 0.4.1 ##
2
8
 
3
9
  * Screenview hit type
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
@@ -1,4 +1,4 @@
1
1
  module Staccato
2
2
  # The current Staccato VERSION
3
- VERSION = "0.4.1"
3
+ VERSION = "0.4.2"
4
4
  end
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.1
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-09 00:00:00.000000000 Z
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