mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[core] identify origin of log messages
This commit is contained in:
parent
7cc4773675
commit
1d481ffb1f
1 changed files with 4 additions and 5 deletions
|
@ -5,7 +5,7 @@ module Fog
|
||||||
:deprecation => ::STDOUT,
|
:deprecation => ::STDOUT,
|
||||||
:warning => ::STDOUT
|
:warning => ::STDOUT
|
||||||
}
|
}
|
||||||
|
|
||||||
@channels[:debug] = ::STDOUT if ENV['DEBUG']
|
@channels[:debug] = ::STDOUT if ENV['DEBUG']
|
||||||
|
|
||||||
def self.[](channel)
|
def self.[](channel)
|
||||||
|
@ -17,20 +17,19 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.debug(message)
|
def self.debug(message)
|
||||||
self.write(:debug, "[light_black][DEBUG] #{message}[/]\n")
|
self.write(:debug, "[light_black][fog][DEBUG] #{message}[/]\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.deprecation(message)
|
def self.deprecation(message)
|
||||||
self.write(:deprecation, "[yellow][DEPRECATION] #{message}[/]\n")
|
self.write(:deprecation, "[yellow][fog][DEPRECATION] #{message}[/]\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.warning(message)
|
def self.warning(message)
|
||||||
self.write(:warning, "[yellow][WARNING] #{message}[/]\n")
|
self.write(:warning, "[yellow][fog][WARNING] #{message}[/]\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.write(key, value)
|
def self.write(key, value)
|
||||||
if channel = @channels[key]
|
if channel = @channels[key]
|
||||||
value.gsub(Formatador::INDENT_REGEX, '')
|
|
||||||
message = if channel.tty?
|
message = if channel.tty?
|
||||||
value.gsub(Formatador::PARSE_REGEX) { "\e[#{Formatador::STYLES[$1.to_sym]}m" }.gsub(Formatador::INDENT_REGEX, '')
|
value.gsub(Formatador::PARSE_REGEX) { "\e[#{Formatador::STYLES[$1.to_sym]}m" }.gsub(Formatador::INDENT_REGEX, '')
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue