eventhub-components 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +17 -17
- data/README.md +77 -77
- data/lib/eventhub/components/exception_writer.rb +3 -1
- data/lib/eventhub/components/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cbcbd549ef8728a95b0a412fa22b0749531a852
|
4
|
+
data.tar.gz: 41f8c68e755637d9c2fc947e568e84350e8256b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4af67089885aa62c6e48ed392707bbc03aea80be191e09ec3a75e9f47cd14019e368650ab97fb55ee5e5c70dcb1f3b0725807018fe465fdef874c3c615a3cf73
|
7
|
+
data.tar.gz: a1ab1e24d4f8002d4bfc2bf876d934e56f7df2abc54cbd9352bcae5463fdf24c379db89597925f64737bb08cddceb25a83c6a887a30389f8d4eaba49bffbc1eb
|
data/.gitignore
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
|
-
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
_yardoc
|
9
|
-
coverage
|
10
|
-
doc/
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
tmp
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
data/README.md
CHANGED
@@ -1,77 +1,77 @@
|
|
1
|
-
# EventHub::Components
|
2
|
-
|
3
|
-
TODO: Write a gem description
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
gem 'eventhub-components'
|
10
|
-
|
11
|
-
And then execute:
|
12
|
-
|
13
|
-
$ bundle
|
14
|
-
|
15
|
-
Or install it yourself as:
|
16
|
-
|
17
|
-
$ gem install eventhub-components
|
18
|
-
|
19
|
-
## Usage
|
20
|
-
|
21
|
-
require 'eventhub/components'
|
22
|
-
|
23
|
-
## General
|
24
|
-
|
25
|
-
This Gem provides shared code for processors and the console app.
|
26
|
-
|
27
|
-
### Pid Files
|
28
|
-
|
29
|
-
Takes care of writing, reading and deleting a PID file
|
30
|
-
|
31
|
-
pid_file = EventHub::Components::PidFile.new('my_application.pid')
|
32
|
-
pid_file.write # writes Process.pid
|
33
|
-
# or
|
34
|
-
pid_file.write(some_process_pid)
|
35
|
-
|
36
|
-
pid_file.read # => "some_pid" (it's a string as it comes from a file)
|
37
|
-
|
38
|
-
pid_file.delete
|
39
|
-
|
40
|
-
|
41
|
-
### Logging
|
42
|
-
|
43
|
-
#### StructuredDataLogger
|
44
|
-
|
45
|
-
Provides a second argument (a hash) to the log methods (debug, info, ...)
|
46
|
-
|
47
|
-
logger = EventHub::Components::StructuredDataLogger.new(some_other_logger, 'app_name' => 'my fancy app', 'env' => 'staging')
|
48
|
-
logger.info("my message", :foo => 1, :bar => 2)
|
49
|
-
|
50
|
-
|
51
|
-
#### MultiLogger
|
52
|
-
|
53
|
-
Forwards calls to all devices that have been added to the multilogger.
|
54
|
-
|
55
|
-
logger = EventHub::Components::MultiLogger.new
|
56
|
-
logger.add_device(some_other_logger_1)
|
57
|
-
logger.add_device(some_other_logger_2)
|
58
|
-
logger.info("Hans")
|
59
|
-
|
60
|
-
#### ExceptionWriter
|
61
|
-
|
62
|
-
Helps writing exceptions and log messages to files. It creates
|
63
|
-
|
64
|
-
writer = EventHub::Components::ExceptionWriter.new() # logs to ./exceptions
|
65
|
-
# or
|
66
|
-
writer = EventHub::Components::ExceptionWriter.new('some_dir', max_number_of_files) # logs to ./exceptions/some_dir
|
67
|
-
|
68
|
-
writer.write(e)
|
69
|
-
|
70
|
-
|
71
|
-
## Contributing
|
72
|
-
|
73
|
-
1. Fork it ( https://github.com/[my-github-username]/eventhub-components/fork )
|
74
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
75
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
76
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
77
|
-
5. Create a new Pull Request
|
1
|
+
# EventHub::Components
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'eventhub-components'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install eventhub-components
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
require 'eventhub/components'
|
22
|
+
|
23
|
+
## General
|
24
|
+
|
25
|
+
This Gem provides shared code for processors and the console app.
|
26
|
+
|
27
|
+
### Pid Files
|
28
|
+
|
29
|
+
Takes care of writing, reading and deleting a PID file
|
30
|
+
|
31
|
+
pid_file = EventHub::Components::PidFile.new('my_application.pid')
|
32
|
+
pid_file.write # writes Process.pid
|
33
|
+
# or
|
34
|
+
pid_file.write(some_process_pid)
|
35
|
+
|
36
|
+
pid_file.read # => "some_pid" (it's a string as it comes from a file)
|
37
|
+
|
38
|
+
pid_file.delete
|
39
|
+
|
40
|
+
|
41
|
+
### Logging
|
42
|
+
|
43
|
+
#### StructuredDataLogger
|
44
|
+
|
45
|
+
Provides a second argument (a hash) to the log methods (debug, info, ...)
|
46
|
+
|
47
|
+
logger = EventHub::Components::StructuredDataLogger.new(some_other_logger, 'app_name' => 'my fancy app', 'env' => 'staging')
|
48
|
+
logger.info("my message", :foo => 1, :bar => 2)
|
49
|
+
|
50
|
+
|
51
|
+
#### MultiLogger
|
52
|
+
|
53
|
+
Forwards calls to all devices that have been added to the multilogger.
|
54
|
+
|
55
|
+
logger = EventHub::Components::MultiLogger.new
|
56
|
+
logger.add_device(some_other_logger_1)
|
57
|
+
logger.add_device(some_other_logger_2)
|
58
|
+
logger.info("Hans")
|
59
|
+
|
60
|
+
#### ExceptionWriter
|
61
|
+
|
62
|
+
Helps writing exceptions and log messages to files. It creates
|
63
|
+
|
64
|
+
writer = EventHub::Components::ExceptionWriter.new() # logs to ./exceptions
|
65
|
+
# or
|
66
|
+
writer = EventHub::Components::ExceptionWriter.new('some_dir', max_number_of_files) # logs to ./exceptions/some_dir
|
67
|
+
|
68
|
+
writer.write(e)
|
69
|
+
|
70
|
+
|
71
|
+
## Contributing
|
72
|
+
|
73
|
+
1. Fork it ( https://github.com/[my-github-username]/eventhub-components/fork )
|
74
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
75
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
76
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
77
|
+
5. Create a new Pull Request
|
@@ -8,7 +8,6 @@ class EventHub::Components::ExceptionWriter
|
|
8
8
|
base = base ||= Dir.pwd
|
9
9
|
@folder = File.join(base, 'exceptions')
|
10
10
|
@max_files = max_files
|
11
|
-
FileUtils.makedirs(folder)
|
12
11
|
end
|
13
12
|
|
14
13
|
|
@@ -16,6 +15,9 @@ class EventHub::Components::ExceptionWriter
|
|
16
15
|
time = Time.now
|
17
16
|
stamp = "#{time.strftime("%Y%m%d_%H%M%S")}_%i" % time.usec
|
18
17
|
|
18
|
+
# create exception folder when it's needed (but not before)
|
19
|
+
FileUtils.makedirs(@folder)
|
20
|
+
|
19
21
|
write_exception("#{stamp}.log", exception)
|
20
22
|
write_message("#{stamp}.msg.raw", message)
|
21
23
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eventhub-components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Novartis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -107,4 +107,3 @@ test_files:
|
|
107
107
|
- spec/components/pid_file_spec.rb
|
108
108
|
- spec/components/structured_data_logger_spec.rb
|
109
109
|
- spec/spec_helper.rb
|
110
|
-
has_rdoc:
|