lex-logger 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f2f5426c2e925fefafa5a02207987cf8570a278feb64f30fcab14986bbd252ce
4
+ data.tar.gz: 78476cbc6227b266aba7b622dff1d27651982a4ed3a136b25bfbcd7d74ea3284
5
+ SHA512:
6
+ metadata.gz: 8753c348b96f981c2939f4b5156f0200e1cd0e38edac7a43c41c6a86577dc0aee6418fca1bc02dfc71b812b67fae9c3e6129e6cc903c2b93fa6a82d4ad587c11
7
+ data.tar.gz: 471878969103fcfa458d4e38313c50284569b46541f54cbe7f218739b5097e12f1d1a579777faa9d2878ae9a7e16a4f10609ca5f0dc55ed4c0b4149306e59a80
@@ -0,0 +1,167 @@
1
+ version: 2 # use CircleCI 2.0
2
+ jobs:
3
+ "rubocop":
4
+ docker:
5
+ - image: circleci/ruby:2.4-node
6
+ steps:
7
+ - checkout
8
+ - run: gem install rubocop
9
+ - run:
10
+ name: Run Rubocop
11
+ command: rubocop
12
+ - store_test_results:
13
+ path: test_results
14
+ "ruby-2.0":
15
+ docker:
16
+ - image: circleci/ruby:2.0
17
+ steps:
18
+ - checkout
19
+ - run:
20
+ name: Bundle Install
21
+ command: bundle install
22
+ - run:
23
+ name: Run RSpec
24
+ command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
25
+ when: always
26
+ - store_test_results:
27
+ path: test-results
28
+ "ruby-2.1":
29
+ docker:
30
+ - image: circleci/ruby:2.1
31
+ steps:
32
+ - checkout
33
+ - run:
34
+ name: Bundle Install
35
+ command: bundle install
36
+ - run:
37
+ name: Run RSpec
38
+ command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
39
+ when: always
40
+ - store_test_results:
41
+ path: test-results
42
+ "ruby-2.2":
43
+ docker:
44
+ - image: circleci/ruby:2.2
45
+ steps:
46
+ - checkout
47
+ - run:
48
+ name: Bundle Install
49
+ command: bundle install
50
+ - run:
51
+ name: Run RSpec
52
+ command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
53
+ when: always
54
+ - store_test_results:
55
+ path: test-results
56
+
57
+ "ruby-2.3":
58
+ docker:
59
+ - image: circleci/ruby:2.3
60
+ steps:
61
+ - checkout
62
+ - run:
63
+ name: Bundle Install
64
+ command: bundle install
65
+ - run:
66
+ name: Run RSpec
67
+ command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
68
+ when: always
69
+ - store_test_results:
70
+ path: test-results
71
+
72
+ "ruby-2.4":
73
+ docker:
74
+ - image: circleci/ruby:2.4-node
75
+ steps:
76
+ - checkout
77
+ - run:
78
+ name: Bundle Install
79
+ command: bundle install
80
+ - run:
81
+ name: Run RSpec
82
+ command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
83
+ when: always
84
+ - store_test_results:
85
+ path: test-results
86
+ "ruby-2.5":
87
+ docker:
88
+ - image: circleci/ruby:2.5-node
89
+ steps:
90
+ - checkout
91
+ - run:
92
+ name: Bundle Install
93
+ command: bundle install
94
+ - run:
95
+ name: Run RSpec
96
+ command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
97
+ when: always
98
+ - store_test_results:
99
+ path: test-results
100
+ "ruby-2.6":
101
+ docker:
102
+ - image: circleci/ruby:2.6-node
103
+ steps:
104
+ - checkout
105
+ - run:
106
+ name: Bundle Install
107
+ command: bundle install
108
+ - run:
109
+ name: Run RSpec
110
+ command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
111
+ when: always
112
+ - store_test_results:
113
+ path: test-results
114
+ "jruby-9.2":
115
+ docker:
116
+ - image: circleci/jruby:9.2
117
+ steps:
118
+ - checkout
119
+ - run:
120
+ name: Bundle Install
121
+ command: bundle install
122
+ - run:
123
+ name: Run RSpec
124
+ command: bundle exec rspec --format progress --format RspecJunitFormatter -o test-results/rspec/results.xml
125
+ when: always
126
+ - store_test_results:
127
+ path: test-results
128
+
129
+ workflows:
130
+ version: 2
131
+ cop_rake_deploy:
132
+ jobs:
133
+ - rubocop
134
+ # - ruby-2.2:
135
+ # requires:
136
+ # - ruby-2.4
137
+ # filters:
138
+ # branches:
139
+ # only: /\bdevelop\b|\bmaster\b/
140
+ - ruby-2.3:
141
+ requires:
142
+ - ruby-2.4
143
+ filters:
144
+ branches:
145
+ only: /\bdevelop\b|\bmaster\b/
146
+ - ruby-2.4:
147
+ requires:
148
+ - rubocop
149
+ - ruby-2.5:
150
+ requires:
151
+ - ruby-2.4
152
+ filters:
153
+ branches:
154
+ only: /\bdevelop\b|\bmaster\b/
155
+ - ruby-2.6:
156
+ requires:
157
+ - ruby-2.4
158
+ filters:
159
+ branches:
160
+ only: /\bdevelop\b|\bmaster\b/
161
+ # - jruby-9.2:
162
+ # requires:
163
+ # - ruby-2.2
164
+ # - ruby-2.3
165
+ # - ruby-2.4
166
+ # - ruby-2.5
167
+ # - ruby-2.6
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /legion/.idea/
11
+ /.idea/
12
+
13
+ # rspec failure tracking
14
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,25 @@
1
+ Metrics/LineLength:
2
+ Max: 120
3
+ Metrics/MethodLength:
4
+ Max: 30
5
+ Metrics/ClassLength:
6
+ Max: 1500
7
+ Metrics/BlockLength:
8
+ Max: 50
9
+ Layout/SpaceAroundEqualsInParameterDefault:
10
+ EnforcedStyle: space
11
+ Style/SymbolArray:
12
+ Enabled: true
13
+ Layout/AlignHash:
14
+ EnforcedHashRocketStyle: table
15
+ EnforcedColonStyle: table
16
+ Style/HashSyntax:
17
+ EnforcedStyle: ruby19_no_mixed_keys
18
+ Style/Documentation:
19
+ Enabled: false
20
+ AllCops:
21
+ TargetRubyVersion: 2.2
22
+ Style/FrozenStringLiteralComment:
23
+ Enabled: false
24
+ Naming/FileName:
25
+ Enabled: false
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.4.5
7
+ before_install: gem install bundler -v 1.17.3
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'legion-extensions', path: '~/legion-io/legion-extensions'
4
+ gem 'legion-transport', path: '~/legion-io/legion-transport'
5
+
6
+ # Specify your gem's dependencies in legion-extensions-logger.gemspec
7
+ gemspec
@@ -0,0 +1,35 @@
1
+ # Legion::Extensions::Logger
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/legion/extensions/logger`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'legion-extensions-logger'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install legion-extensions-logger
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ 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.
30
+
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).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/legion-extensions-logger.
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'legion/extensions/logger'
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(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,40 @@
1
+ lib = File.expand_path('lib', __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'legion/extensions/logger/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'lex-logger'
7
+ spec.version = Legion::Extensions::Logger::VERSION
8
+ spec.authors = ['Miverson']
9
+ spec.email = ['matthewdiverson@gmail.com']
10
+
11
+ spec.summary = 'LEX::Logger'
12
+ spec.description = 'Used to write logs in an eventful way'
13
+ spec.homepage = 'https://bitbucket.org/legion-io/lex-logger'
14
+
15
+ if spec.respond_to?(:metadata)
16
+ spec.metadata['homepage_uri'] = spec.homepage
17
+ spec.metadata['source_code_uri'] = 'https://bitbucket.org/legion-io/lex-logger'
18
+ spec.metadata['changelog_uri'] = 'https://bitbucket.org/legion-io/lex-logger'
19
+ else
20
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
21
+ 'public gem pushes.'
22
+ end
23
+
24
+ # Specify which files should be added to the gem when it is released.
25
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
26
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
27
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
28
+ end
29
+ spec.bindir = 'exe'
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ['lib']
32
+
33
+ spec.add_dependency 'legion-extensions'
34
+
35
+ spec.add_development_dependency 'bundler', '~> 1.17'
36
+ spec.add_development_dependency 'legion-logging'
37
+ spec.add_development_dependency 'legion-transport'
38
+ spec.add_development_dependency 'rake', '~> 10.0'
39
+ spec.add_development_dependency 'rspec', '~> 3.0'
40
+ end
@@ -0,0 +1,45 @@
1
+ require 'legion/extensions/logger/version'
2
+ require 'legion/extensions'
3
+ require 'legion/extensions/default'
4
+
5
+ require 'legion/extensions/logger/actors/logger'
6
+
7
+ module Legion
8
+ module Extensions
9
+ module Logger
10
+ extend Legion::Extensions::Default
11
+ attr_reader :actors, :requirements, :default_settings, :autobuild
12
+ def self.klass
13
+ Legion::Extensions::Logger
14
+ end
15
+
16
+ def self.path
17
+ 'legion/extensions/logger/'
18
+ end
19
+
20
+ def self.actors
21
+ [{
22
+ path: path + 'actors/logger',
23
+ class: klass::Actor::Logger,
24
+ group_name: 'logger'
25
+ }]
26
+ end
27
+
28
+ def self.lex_methods
29
+ [{
30
+ namespace: 'legion::extensions::logger::runners::logger',
31
+ queue: 'logger',
32
+ uri: 'logger',
33
+ class_methods: {
34
+ to_stdout: {},
35
+ to_file: {}
36
+ }
37
+ }]
38
+ end
39
+
40
+ def self.requirements
41
+ ['legion-transport']
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,27 @@
1
+ require 'legion/extensions/logger/runners/logger'
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Logger
6
+ module Actor
7
+ class Logger < Legion::Extensions::Actors::Subscription
8
+ def queue
9
+ Legion::Extensions::Logger::Transport::Queues::Logger
10
+ end
11
+
12
+ def class_path
13
+ 'legion/extensions/logger/runners/logger'
14
+ end
15
+
16
+ def runner_class
17
+ Legion::Extensions::Logger::Runners::Logger
18
+ end
19
+
20
+ def runner_method
21
+ 'to_stdout'
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,25 @@
1
+ require 'legion/logging/logger'
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Logger
6
+ module Runners
7
+ module Logger
8
+ def self.to_stdout(payload)
9
+ logger = Legion::Logging::Logger.new.setup
10
+ if payload[:level] == 'warn'
11
+ logger.warn(payload[:message])
12
+ elsif payload[:level] == 'error'
13
+ logger.error(payload[:message])
14
+ else
15
+ logger.info(payload[:message])
16
+ end
17
+ { status: 'success', message: payload[:message], level: payload[:level] }
18
+ end
19
+
20
+ def self.to_file(payload); end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,22 @@
1
+ require 'legion/extensions/transport/autobuild'
2
+
3
+ require 'legion/extensions/logger/transport/exchanges/logger'
4
+ require 'legion/extensions/logger/transport/queues/logger'
5
+
6
+ module Legion
7
+ module Extensions
8
+ module Logger
9
+ module Transport
10
+ module AutoBuild
11
+ extend Legion::Extensions::Transport::AutoBuild
12
+ def self.e_to_q
13
+ [{
14
+ from: Legion::Extensions::Logger::Transport::Exchanges::Logger,
15
+ to: Legion::Extensions::Logger::Transport::Queues::Logger
16
+ }]
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,15 @@
1
+ module Legion
2
+ module Extensions
3
+ module Logger
4
+ module Transport
5
+ module Exchanges
6
+ class Logger < Legion::Transport::Exchange
7
+ def exchange_name
8
+ 'logger'
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Legion
2
+ module Extensions
3
+ module Logger
4
+ module Transport
5
+ module Queues
6
+ class Logger < Legion::Transport::Queue
7
+ def queue_name
8
+ 'logger'
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,7 @@
1
+ module Legion
2
+ module Extensions
3
+ module Logger
4
+ VERSION = '0.1.0'.freeze
5
+ end
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,148 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lex-logger
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Miverson
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-02-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: legion-extensions
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.17'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.17'
41
+ - !ruby/object:Gem::Dependency
42
+ name: legion-logging
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: legion-transport
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ description: Used to write logs in an eventful way
98
+ email:
99
+ - matthewdiverson@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".circleci/config.yml"
105
+ - ".gitignore"
106
+ - ".rspec"
107
+ - ".rubocop.yml"
108
+ - ".travis.yml"
109
+ - Gemfile
110
+ - README.md
111
+ - Rakefile
112
+ - bin/console
113
+ - bin/setup
114
+ - legion-extensions-logger.gemspec
115
+ - lib/legion/extensions/logger.rb
116
+ - lib/legion/extensions/logger/actors/logger.rb
117
+ - lib/legion/extensions/logger/runners/logger.rb
118
+ - lib/legion/extensions/logger/transport/autobuild.rb
119
+ - lib/legion/extensions/logger/transport/exchanges/logger.rb
120
+ - lib/legion/extensions/logger/transport/queues/logger.rb
121
+ - lib/legion/extensions/logger/version.rb
122
+ homepage: https://bitbucket.org/legion-io/lex-logger
123
+ licenses: []
124
+ metadata:
125
+ homepage_uri: https://bitbucket.org/legion-io/lex-logger
126
+ source_code_uri: https://bitbucket.org/legion-io/lex-logger
127
+ changelog_uri: https://bitbucket.org/legion-io/lex-logger
128
+ post_install_message:
129
+ rdoc_options: []
130
+ require_paths:
131
+ - lib
132
+ required_ruby_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ requirements: []
143
+ rubyforge_project:
144
+ rubygems_version: 2.7.8
145
+ signing_key:
146
+ specification_version: 4
147
+ summary: LEX::Logger
148
+ test_files: []