filum 0.0.1 → 0.0.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: 13b627904eec57084103ef8e29d4aa7be606eed7
4
- data.tar.gz: 5e6292138d8a15324fa8172dcfe05f143f7f2510
3
+ metadata.gz: cc7fea2cacec8aaaa40b2017b9af8fc54c2aa224
4
+ data.tar.gz: d93d4e4bca152a0569e2d88be143c508a7fedaa1
5
5
  SHA512:
6
- metadata.gz: 28997c2b267ca21f05508030fa5885a4ee7f90343690c547d06fbc53d7b3060a3be1716bf8406d82328ec6ea2a41b41210b987ec1298113756b2e03f41b43f72
7
- data.tar.gz: 3c80aa8ed05465a007f6522338dcbc1a865f211bc066f19b658e4de1740722f265847509a4e14976509be37ee66e87f2ece7d95bfb19e15e16d09ad7432c982a
6
+ metadata.gz: 23153c103796478843318c97a3bb5753ffca5b824f62c42106e9f518b43a4c614cf5f976699d3d043736ca7e8b5ca764150e983724b197f36271543e55f50daa
7
+ data.tar.gz: 7e6d5ce623f159cadefcdc63ffcd11e8e5629dcbf92d70a75125a95d377eeb339bf56b186c933287a989514a4246bba394df4b716d4dfa5dfec661f10567e426
data/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Filum
2
2
 
3
+ [![Build Status](https://travis-ci.org/meducation/filum.png)](https://travis-ci.org/meducation/filum)
4
+ [![Dependencies](https://gemnasium.com/meducation/filum.png?travis)](https://gemnasium.com/meducation/filum)
5
+ [![Code Climate](https://codeclimate.com/github/meducation/filum.png)](https://codeclimate.com/github/meducation/filum)
6
+
7
+
3
8
  Filum is a logger which automatically adds a context id to each log line.
4
9
 
5
10
  This is useful when logging in multi threaded and multi process environments.
data/lib/filum.rb CHANGED
@@ -32,7 +32,13 @@ module Filum
32
32
  # Filum.logger.info "Log this"
33
33
  #
34
34
  def self.logger
35
- @logger ||= Filum::Logger.new(Filum.config.logfile)
35
+ logfile = Filum.config.logfile
36
+ dir = File.dirname(logfile)
37
+ unless File.directory?(dir)
38
+ FileUtils.mkdir_p(dir)
39
+ end
40
+
41
+ @logger ||= Filum::Logger.new(logfile)
36
42
  @logger.level = Logger::INFO
37
43
  @logger
38
44
  end
data/lib/filum/logger.rb CHANGED
@@ -7,23 +7,23 @@ module Filum
7
7
  end
8
8
 
9
9
  def info(str)
10
- super("#{DateTime.now} thread_id-#{Thread.current.object_id} #{caller[0]} [#{Thread.current[:context_id]}] INFO | #{str}")
10
+ super("#{DateTime.now} thread_id-#{Thread.current.object_id} [#{Thread.current[:context_id]}] INFO | #{str} | #{caller[0]}")
11
11
  end
12
12
 
13
13
  def fatal(str)
14
- super("#{DateTime.now} thread_id-#{Thread.current.object_id} #{caller[0]} [#{Thread.current[:context_id]}] FATAL | #{str}")
14
+ super("#{DateTime.now} thread_id-#{Thread.current.object_id} [#{Thread.current[:context_id]}] FATAL | #{str} | #{caller[0]}")
15
15
  end
16
16
 
17
17
  def error(str)
18
- super("#{DateTime.now} thread_id-#{Thread.current.object_id} #{caller[0]} [#{Thread.current[:context_id]}] ERROR | #{str}")
18
+ super("#{DateTime.now} thread_id-#{Thread.current.object_id} [#{Thread.current[:context_id]}] ERROR | #{str} | #{caller[0]}")
19
19
  end
20
20
 
21
21
  def warn(str)
22
- super("#{DateTime.now} thread_id-#{Thread.current.object_id} #{caller[0]} [#{Thread.current[:context_id]}] WARN | #{str}")
22
+ super("#{DateTime.now} thread_id-#{Thread.current.object_id} [#{Thread.current[:context_id]}] WARN | #{str} | #{caller[0]}")
23
23
  end
24
24
 
25
25
  def debug(str)
26
- super("#{DateTime.now} thread_id-#{Thread.current.object_id} #{caller[0]} [#{Thread.current[:context_id]}] DEBUG | #{str}")
26
+ super("#{DateTime.now} thread_id-#{Thread.current.object_id} [#{Thread.current[:context_id]}] DEBUG | #{str} | #{caller[0]}")
27
27
  end
28
28
  end
29
29
  end
data/lib/filum/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Filum
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -7,7 +7,7 @@ module Filum
7
7
  super
8
8
 
9
9
  Filum.config do |config|
10
- config.logfile = "/tmp/filum_test_#{Time.now.to_i}.log"
10
+ config.logfile = "/tmp/log/filum_test_#{Time.now.to_i}.log"
11
11
  end
12
12
  end
13
13
  end
@@ -15,7 +15,7 @@ module Filum
15
15
  Worker.process
16
16
  end
17
17
  test_thread.join
18
- assert_logged(/\[12345\] Processing/)
18
+ assert_logged(/\[12345\]/)
19
19
  end
20
20
 
21
21
  def test_multiple_threads
@@ -29,8 +29,8 @@ module Filum
29
29
  end
30
30
  test_thread1.join
31
31
  test_thread2.join
32
- assert_logged(/\[23456\] Processing/)
33
- assert_logged(/\[34567\] Processing/)
32
+ assert_logged(/\[23456\]/)
33
+ assert_logged(/\[34567\]/)
34
34
  end
35
35
 
36
36
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - MalcyL
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-20 00:00:00.000000000 Z
11
+ date: 2013-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler