magic_logger 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/Gemfile +2 -0
- data/LICENSE +21 -0
- data/README.md +33 -0
- data/Rakefile +0 -0
- data/lib/magic_logger.rb +2 -0
- data/lib/magic_logger/magic_logger.rb +35 -0
- data/lib/magic_logger/version.rb +3 -0
- data/magic_logger.gemspec +23 -0
- metadata +54 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: eaf4f40530c44a7a1eb701c07300100003fb2835
|
4
|
+
data.tar.gz: 2dfef8bc3626ca531fe2c1b82bbbaaac7778ad2d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 58acfb7ef7aaabe5514beebe5e7a602b43c19a73b32e13eaee83c7cd5cc31714f9189c4a98f7fdc7178b34d8712f4041bcab9cda64b55d186fb500353f1a4c8f
|
7
|
+
data.tar.gz: 62e6910f85ec71fd9ae07cb1f8208c6571ba0fd31babbfca090626256e485b8f3c5f8d65dcb5665da8f80172b4b45c7b1a20cfca6c5111c6eef08655f0ee5648
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
.idea
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT LICENSE
|
2
|
+
|
3
|
+
Copyright (c) Justin Commu <Justin.Commu@loblaw.ca>
|
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
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# WebTest
|
2
|
+
|
3
|
+
Welcome to magic_logger!
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'magic_logger'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install magic_logger
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: Write usage instructions here
|
24
|
+
|
25
|
+
## Development
|
26
|
+
|
27
|
+
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).
|
28
|
+
|
29
|
+
|
30
|
+
## License
|
31
|
+
|
32
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
33
|
+
|
data/Rakefile
ADDED
File without changes
|
data/lib/magic_logger.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
class MagicLogger
|
4
|
+
|
5
|
+
@formatted = {}
|
6
|
+
@raw = {}
|
7
|
+
|
8
|
+
class << self
|
9
|
+
attr_accessor :raw, :formatted
|
10
|
+
|
11
|
+
def log(title, value)
|
12
|
+
entry = case value
|
13
|
+
when Hash then format_hash(value)
|
14
|
+
when Array then format_array(value)
|
15
|
+
else value
|
16
|
+
end
|
17
|
+
@raw.key?(title) ? @raw[title] << "\n #{entry}" : @raw[title] = entry.to_s
|
18
|
+
end
|
19
|
+
|
20
|
+
def process
|
21
|
+
@formatted = @raw.map { |k, v| "\n#{k}:\n #{v}" }.join("\n")
|
22
|
+
@raw.clear
|
23
|
+
@formatted
|
24
|
+
end
|
25
|
+
|
26
|
+
def format_hash(hash)
|
27
|
+
hash.map { |k, v| "#{k}: #{v}" }.join("\n ")
|
28
|
+
end
|
29
|
+
|
30
|
+
def format_array(array)
|
31
|
+
array.join("\n ")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'magic_logger/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'magic_logger'
|
8
|
+
spec.version = Version::VERSION
|
9
|
+
spec.authors = ['Justin Commu']
|
10
|
+
spec.email = ['Justin.Commu@loblaw.ca']
|
11
|
+
spec.summary = 'Logging tool which accepts Hashes, Arrays, and Strings'
|
12
|
+
spec.description = 'Use this library effectively log different data types'
|
13
|
+
spec.homepage = 'https://loblawdigital.ca'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
spec.bindir = 'exe'
|
17
|
+
spec.platform = Gem::Platform::RUBY
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
|
metadata
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: magic_logger
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Justin Commu
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-05-29 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Use this library effectively log different data types
|
14
|
+
email:
|
15
|
+
- Justin.Commu@loblaw.ca
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".gitignore"
|
21
|
+
- Gemfile
|
22
|
+
- LICENSE
|
23
|
+
- README.md
|
24
|
+
- Rakefile
|
25
|
+
- lib/magic_logger.rb
|
26
|
+
- lib/magic_logger/magic_logger.rb
|
27
|
+
- lib/magic_logger/version.rb
|
28
|
+
- magic_logger.gemspec
|
29
|
+
homepage: https://loblawdigital.ca
|
30
|
+
licenses:
|
31
|
+
- MIT
|
32
|
+
metadata: {}
|
33
|
+
post_install_message:
|
34
|
+
rdoc_options: []
|
35
|
+
require_paths:
|
36
|
+
- lib
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
requirements: []
|
48
|
+
rubyforge_project:
|
49
|
+
rubygems_version: 2.5.1
|
50
|
+
signing_key:
|
51
|
+
specification_version: 4
|
52
|
+
summary: Logging tool which accepts Hashes, Arrays, and Strings
|
53
|
+
test_files: []
|
54
|
+
has_rdoc:
|