yajl 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.markdown +111 -9
  3. data/lib/yajl/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e57dd3ad6e9d67bb8db23883782f11c42efbc99e
4
- data.tar.gz: 4101c2a16cff4e94121a52c5dbd41b872c460219
3
+ metadata.gz: 9fdfad3b5149928729686a23f0951a7daedd3fcb
4
+ data.tar.gz: 4aa1bf76f6f5a80853a351d542def1d3d279bf97
5
5
  SHA512:
6
- metadata.gz: bb4696c3f943ad12873078c9cfbb9fff25ce8d6f18a887be6a056025a4ebfb6c717fffac28c3e232ca46c5dcc5b12835419d241e7dc2b3b8ce07749edd4fb408
7
- data.tar.gz: e8bc971062c3cf6201ff0944a622c3ec476a6dbcbb723e88bcb3584ec20e18acab6035e9c14dac8474324e2fc2b49ce68fed3b96c7936a5333c13868a3d2d066
6
+ metadata.gz: 79769d884f5a0a663f0ad4ce8b6b3a4fb776ae828f59d4f272ee55cda3f5baf5f38c805c462c97158319fe2eadccfae8f5f67945464234af7d2c64b50c097f24
7
+ data.tar.gz: a2e6d2141af656d674a40b132e750592013502c458045cc67929c4d3e6dcb87aac9ad0a5fd0b8361ec58bab3028d1624c729b42ac06e5fe8f43121af0d924e6e
data/README.markdown CHANGED
@@ -1,8 +1,14 @@
1
- # Yajl
1
+ # Yajl - Version 0.2.1
2
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/yajl`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Yet another JSON logger. I like Ruby's logger, but it's annoying to
4
+ always set it up. I like flexible, machine and human readable logs.
5
+ I want simplicity and brevity. I want to dump JSON in my logs
6
+ without screwing around, and I want to be able to easily log text.
4
7
 
5
- TODO: Delete this and the text above, and describe your gem
8
+ ## TODOs
9
+
10
+ 1. Tests. I guess. Maybe.
11
+ 2. Maybe rewrite this in [Nim](http://nim-lang.org/) and wrap it in the Ruby FFI. I'd have to be logging a *lot* to justify it though.
6
12
 
7
13
  ## Installation
8
14
 
@@ -22,19 +28,115 @@ Or install it yourself as:
22
28
 
23
29
  ## Usage
24
30
 
25
- TODO: Write usage instructions here
31
+ ```ruby
32
+ require 'yajl'
33
+
34
+ logger = Yajl.create_logger
35
+ logger.warn "danger"
36
+ ```
37
+
38
+ Will produce the following
39
+ (although it has been pretty printed for readability):
40
+
41
+ ```json
42
+ {
43
+ "id": "44fa7a8f0186092d849ac1ea263ceb3f",
44
+ "severity": "WARN",
45
+ "datetime": "2015-08-24 18:22:12 UTC",
46
+ "progname": null,
47
+ "message": {
48
+ "text": "danger"
49
+ }
50
+ }
51
+ ```
52
+
53
+ You can also log data structures:
54
+
55
+ ```ruby
56
+ require 'yajl'
57
+
58
+ logger = Yajl.create_logger
59
+ interesting_data = { banana_count: 2345, text: "So many bananas!" }
60
+ logger.info interesting_data
61
+ ```
62
+
63
+ Which produces:
64
+
65
+ ```json
66
+ {
67
+ "datetime": "2015-08-24 18:43:24 UTC",
68
+ "id": "4ae209a739a7bb562d7b55dfba88fc4e",
69
+ "message": {
70
+ "banana_count": 2345,
71
+ "text": "So many bananas!"
72
+ },
73
+ "progname": null,
74
+ "severity": "INFO"
75
+ }
76
+ ```
77
+
78
+ And because it is just a normal Ruby logger, you can also do:
79
+
80
+ ```ruby
81
+ require 'yajl'
82
+
83
+ logger = Yajl.create_logger
84
+ logger.fatal("deathstar") { "Nooooo" }
85
+ ```
86
+
87
+ Which sets the `progname` attribute.
88
+
89
+ ```json
90
+ {
91
+ "datetime": "2015-08-24 18:48:37 UTC",
92
+ "id": "3e6dfcc2038dd0dec5e4be21574cb76d",
93
+ "message": {
94
+ "text": "Nooooo"
95
+ },
96
+ "progname": "deathstar",
97
+ "severity": "FATAL"
98
+ }
99
+ ```
100
+
101
+ By default logs are stored in `~/logs` with a very sensible
102
+ logger name. If even one person wants the ability to change the
103
+ filename that is set I'll add the support to do so. Right now it
104
+ looks like this:
105
+
106
+ `/home/zach/logs/zach@Lux.yajl.log`
107
+
108
+ or like this:
109
+
110
+ `/home/zach/logs/zach@Lux.yajl.log.1`
111
+
112
+ If there are multiple running processes (just like the normal Ruby
113
+ processor.
114
+
115
+ Note, it gets the name of the project from your Git project name.
116
+ If you don't use Git let me know and I'll make this toggleable too.
26
117
 
27
118
  ## Development
28
119
 
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.
120
+ After checking out the repo, run `bin/setup` to install
121
+ dependencies. You can also run `bin/console` for an interactive
122
+ prompt that will allow you to experiment.
30
123
 
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).
124
+ To install this gem onto your local machine, run
125
+ `bundle exec rake install`.
32
126
 
33
- ## Contributing
127
+ ### Stuff that only I need to do
128
+
129
+ To release a new version, update the version number in
130
+ `version.rb`, and then run `bundle exec rake release`, which
131
+ will create a git tag for the version, push git commits and tags,
132
+ and push the `.gem` file to [rubygems.org](https://rubygems.org).
34
133
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/zachaysan/yajl. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
134
+ ## Contributing
36
135
 
136
+ Bug reports and pull requests are welcome on GitHub at
137
+ https://github.com/zachaysan/yajl. Matz is nice. Be like Matz.
37
138
 
38
139
  ## License
39
140
 
40
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
141
+ The gem is available as open source under the terms of the
142
+ [MIT License](http://opensource.org/licenses/MIT).
data/lib/yajl/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Yajl
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yajl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Aysan