scrolls 0.9.3 → 0.9.4

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
  SHA256:
3
- metadata.gz: d70168aa379a644e25091bce26f7ce86e3ffb9d6564a97246d3e6251fbe353ad
4
- data.tar.gz: 813b7fc23789ea3436e4f18f1be99f601ec034fbf737e70bfbf8705948676aed
3
+ metadata.gz: 2c46a03de696acee9e14e71d9e2a373415e9fa60532a7ac51896f71b5e0286ca
4
+ data.tar.gz: 9d9af16e271f1ff468fb778c8d5e05d9f215909adf77cdbf144204d2b3d8836e
5
5
  SHA512:
6
- metadata.gz: a419f6a9473eeaa2f7957db5d30ee5d1977149861542a7e28feb7e126f7413ee6a9876ff76e30414620fcf8a43eaa0abafe79408b23db0c4415a06f048ad5653
7
- data.tar.gz: 3be6e7a630e21b35be17bf59ac480a40f2b98eec106c27dacfc245765574e317c680b5587a55064e5883b420c272ca1cdab687ac2052316fdbf53efdde7f9e45
6
+ metadata.gz: 9aa2a50b5c00379872e54384b8f0b6050f82ab5f86e66bb2eca544a7ea5845ac4672dcc758e948d9b3af84b6d61af7972ca937be21854010002325c89b176865
7
+ data.tar.gz: 992fc115e62d9a2ea39305a72db4bfd0868c0f64d2e1a47082136ecf01e2d7a16461bbfb69e5bb38da628a4e1331685c4f6da275277e9793dfe5c5a8a808c496
data/LICENSE CHANGED
@@ -1,7 +1,7 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright © Curt Micol <asenchi@asenchi.com> 2012,2013,2014
4
- Copyright © Heroku 2012
3
+ Copyright (c) 2013-2021 Curt Micol <asenchi@asenchi.com>
4
+ Copyright (c) 2012, Heroku
5
5
 
6
6
  Permission is hereby granted, free of charge, to any person obtaining
7
7
  a copy of this software and associated documentation files (the
@@ -1,3 +1,3 @@
1
1
  module Scrolls
2
- VERSION = "0.9.3"
2
+ VERSION = "0.9.4"
3
3
  end
data/lib/scrolls.rb CHANGED
@@ -222,6 +222,7 @@ module Scrolls
222
222
  # => nil
223
223
  #
224
224
  def debug(data, &blk)
225
+ data = coalesce_strings_to_hash(data)
225
226
  data = data.merge(:level => "debug") if data.is_a?(Hash)
226
227
  @log.log(data, &blk)
227
228
  end
@@ -240,6 +241,7 @@ module Scrolls
240
241
  # => nil
241
242
  #
242
243
  def error(data, &blk)
244
+ data = coalesce_strings_to_hash(data)
243
245
  data = data.merge(:level => "warning") if data.is_a?(Hash)
244
246
  @log.log(data, &blk)
245
247
  end
@@ -258,6 +260,7 @@ module Scrolls
258
260
  # => nil
259
261
  #
260
262
  def fatal(data, &blk)
263
+ data = coalesce_strings_to_hash(data)
261
264
  data = data.merge(:level => "error") if data.is_a?(Hash)
262
265
  @log.log(data, &blk)
263
266
  end
@@ -276,6 +279,7 @@ module Scrolls
276
279
  # => nil
277
280
  #
278
281
  def info(data, &blk)
282
+ data = coalesce_strings_to_hash(data)
279
283
  data = data.merge(:level => "info") if data.is_a?(Hash)
280
284
  @log.log(data, &blk)
281
285
  end
@@ -294,6 +298,7 @@ module Scrolls
294
298
  # => nil
295
299
  #
296
300
  def warn(data, &blk)
301
+ data = coalesce_strings_to_hash(data)
297
302
  data = data.merge(:level => "notice") if data.is_a?(Hash)
298
303
  @log.log(data, &blk)
299
304
  end
@@ -312,6 +317,7 @@ module Scrolls
312
317
  # => nil
313
318
  #
314
319
  def unknown(data, &blk)
320
+ data = coalesce_strings_to_hash(data)
315
321
  data = data.merge(:level => "alert") if data.is_a?(Hash)
316
322
  @log.log(data, &blk)
317
323
  end
@@ -322,4 +328,8 @@ module Scrolls
322
328
  @log
323
329
  end
324
330
 
331
+ def coalesce_strings_to_hash(string_or_something_else)
332
+ return string_or_something_else unless string_or_something_else.is_a?(String)
333
+ { "log_message" => string_or_something_else }
334
+ end
325
335
  end
data/test/test_scrolls.rb CHANGED
@@ -223,22 +223,22 @@ class TestScrolls < Minitest::Test
223
223
 
224
224
  def test_sending_string_error
225
225
  Scrolls.error("error")
226
- assert_equal "log_message=error\n", @out.string
226
+ assert_equal "log_message=error level=warning\n", @out.string
227
227
  end
228
228
 
229
229
  def test_sending_string_fatal
230
230
  Scrolls.fatal("fatal")
231
- assert_equal "log_message=fatal\n", @out.string
231
+ assert_equal "log_message=fatal level=error\n", @out.string
232
232
  end
233
233
 
234
234
  def test_sending_string_warn
235
235
  Scrolls.warn("warn")
236
- assert_equal "log_message=warn\n", @out.string
236
+ assert_equal "log_message=warn level=notice\n", @out.string
237
237
  end
238
238
 
239
239
  def test_sending_string_unknown
240
240
  Scrolls.unknown("unknown")
241
- assert_equal "log_message=unknown\n", @out.string
241
+ assert_equal "log_message=unknown level=alert\n", @out.string
242
242
  end
243
243
 
244
244
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrolls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Curt Micol
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-15 00:00:00.000000000 Z
11
+ date: 2021-10-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Logging, easier, more consistent.
14
14
  email: