Class: Jekyll::Assets::Logger
- Inherits:
-
Object
- Object
- Jekyll::Assets::Logger
- Defined in:
- lib/jekyll/assets/logger.rb
Constant Summary collapse
- PREFIX =
"Assets: "
- COLORS =
{ error: :red, debug: :yellow, info: :cyan, }.freeze
Class Method Summary collapse
-
.colorize? ⇒ Boolean
–.
-
.err_file(file) ⇒ Object
–.
-
.logger ⇒ Object
–.
-
.with_timed_logging(msg, type: :debug) ⇒ Object
–.
Instance Method Summary collapse
-
#v ⇒ Object
– Creates self methods so that we can accept blocks.
Class Method Details
.colorize? ⇒ Boolean
–
41 42 43 44 45 |
# File 'lib/jekyll/assets/logger.rb', line 41 def self.colorize? @color ||= begin Jekyll.env == "development" && system("test -t 2") end end |
.err_file(file) ⇒ Object
–
36 37 38 |
# File 'lib/jekyll/assets/logger.rb', line 36 def self.err_file(file) Jekyll.logger.error("Asset File", file) end |
.logger ⇒ Object
–
18 19 20 |
# File 'lib/jekyll/assets/logger.rb', line 18 def self.logger self end |
.with_timed_logging(msg, type: :debug) ⇒ Object
–
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/jekyll/assets/logger.rb', line 23 def self.with_timed_logging(msg, type: :debug) s, t, out = Time.now, nil, yield; Logger.send(type) do format("\n#{msg}", { time: "#{t = Time.now - s}s", }) end { result: out, time: t } end |
Instance Method Details
#v ⇒ Object
Note:
this is to be removed after 3.6.
– Creates self methods so that we can accept blocks. –
69 70 71 72 73 |
# File 'lib/jekyll/assets/logger.rb', line 69 %i(warn error info debug).each do |v| make_logger({ type: v, }) end |