cogger 0.6.0 → 0.7.0

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.
data/lib/cogger/color.rb DELETED
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "pastel"
4
-
5
- module Cogger
6
- # Provides default colors for all log levels.
7
- class Color
8
- DEFAULTS = {
9
- debug: %i[white],
10
- info: %i[green],
11
- warn: %i[yellow],
12
- error: %i[red],
13
- fatal: %i[white bold on_red],
14
- unknown: %i[white bold],
15
- any: %i[white bold]
16
- }.freeze
17
-
18
- def initialize defaults: DEFAULTS, decorator: Pastel.new(enabled: $stdout.tty?)
19
- @defaults = defaults
20
- @decorator = decorator
21
- end
22
-
23
- def debug(text) = decorate text, __method__
24
-
25
- def info(text) = decorate text, __method__
26
-
27
- def warn(text) = decorate text, __method__
28
-
29
- def error(text) = decorate text, __method__
30
-
31
- def fatal(text) = decorate text, __method__
32
-
33
- def unknown(text) = decorate text, __method__
34
-
35
- def any(text) = decorate text, __method__
36
-
37
- private
38
-
39
- attr_reader :defaults, :decorator
40
-
41
- def decorate(text, kind) = decorator.decorate text, *defaults.fetch(kind)
42
- end
43
- end