tiny_log 2.0.0 → 2.1.1

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tiny_log.rb +11 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e5e2cc1eee03fc86a34571b2fb6e55a080162bb3ac6b9598bbb34f0ef491afb
4
- data.tar.gz: b68b82266ca779f4b83e700ca1e13314255a5ad481951b37d54a406c1aa715ba
3
+ metadata.gz: fdeec49e70883397600641a4ddb344291a2628c1de5395d396a6f3b5856eb97b
4
+ data.tar.gz: f0324ca37a82ba0b241cb66120d12db51359e30bb21fe3996f309685d49e5222
5
5
  SHA512:
6
- metadata.gz: d110256b17ab42ebf1d4acde5dd10c981ad7889245dd37ae0e38e4b890e5a46a3224459e87491aac210ea7de88ff0979e4f14c21bc18e74db1659afe33febf82
7
- data.tar.gz: 00c580ecfdecb2a8882264ed92b8d4f1cc80631fa9e0a3648eedd6bae9581257d0148110f116c757c50857dfe3249dfd10472c64d312e6b55606065527a7cb3f
6
+ metadata.gz: a2fc50e257d0f1f9dc6132eb19e378c80fd7d91d3997ca992285fa449a18cd3ad4a85a5149cb2458ef42278caeeac0074ab0c1b059f17195a6702f959eede193
7
+ data.tar.gz: a6030d2a9bfe50fe0eec58abe00a5c396709af3f331f1d3e72ab1c1d2891360dc4133f658bdd3c4d725e7da431af1f40ddb64afccda2b87364ef6792380dd456
data/lib/tiny_log.rb CHANGED
@@ -7,7 +7,7 @@ require 'time'
7
7
  # - the log message
8
8
  #
9
9
  # Ex:
10
- # l = Log.new
10
+ # l = TinyLog.new
11
11
  # l.erro('hi there')
12
12
  # l.erro('hi there')
13
13
  # 2022-11-18T01:26:37.086295Z 92967 ERRO hi there
@@ -40,16 +40,24 @@ class TinyLog
40
40
  end
41
41
  end
42
42
 
43
+ # flushes the underlying IO object; especially useful when buffering is
44
+ # enabled, or when you're exiting the application.
45
+ def flush
46
+ @io.flush
47
+
48
+ nil
49
+ end
50
+
43
51
  # the clever bit that annotates the log message with a log level and UTC
44
52
  # timestamp
45
53
  def method_missing(prefix, *msgs)
46
- msgs.each{|m| _build_lines(m).each{|l| @background_thread ? @msg_queue << l : @io.puts(l) } }
54
+ msgs.each{|m| _build_lines(m, prefix).each{|l| @background_thread ? @msg_queue << l : @io.puts(l) } }
47
55
  @io.flush unless @buffering
48
56
 
49
57
  nil
50
58
  end
51
59
 
52
- def _build_lines(m)
60
+ def _build_lines(m, prefix)
53
61
  m.to_s.lines.map do |l|
54
62
  "#{Time.now.utc.iso8601(6)} #{Process.pid.to_s.rjust(6)} #{prefix.to_s.upcase} #{l}"
55
63
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny_log
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Lunt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-21 00:00:00.000000000 Z
11
+ date: 2025-04-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: a tiny logger with almost no features
14
14
  email: jefflunt@gmail.com