Module: BibSync::Log
- Included in:
- Actions::CheckArXivVersions, Actions::DetermineArXivDOI, Actions::FetchFromArXiv, Actions::FindMyCitations, Actions::SynchronizeFiles, Actions::SynchronizeMetadata, Actions::Validate, JabRefFormatter
- Defined in:
- lib/bibsync/log.rb
Constant Summary collapse
- Reset =
"\e[0m"
- Red =
"\e[31m"
- Yellow =
"\e[33m"
- Blue =
"\e[36m"
- Level =
{ debug: nil, info: nil, notice: Blue, warning: Yellow, error: Red, }
Class Attribute Summary collapse
-
.level ⇒ Object
Returns the value of attribute level.
-
.trace ⇒ Object
Returns the value of attribute trace.
Instance Method Summary collapse
Class Attribute Details
.level ⇒ Object
Returns the value of attribute level.
17 18 19 |
# File 'lib/bibsync/log.rb', line 17 def level @level end |
.trace ⇒ Object
Returns the value of attribute trace.
17 18 19 |
# File 'lib/bibsync/log.rb', line 17 def trace @trace end |
Instance Method Details
#log(level, message, opts = {}) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/bibsync/log.rb', line 29 def log(level, , opts = {}) return if Level.keys.index(level) < Level.keys.index(Log.level) = "#{} - #{opts[:ex].}" if opts[:ex] = "#{Level[level]}#{}#{Reset}" if Level[level] if key = opts[:key] key = key.key if key.respond_to? :key = "#{key} : #{}" end puts() if Log.trace && ex = opts[:ex] puts(ex.backtrace.join("\n")) end end |