Module: PtLogger
- Defined in:
- lib/pt_logger/base.rb,
lib/pt_logger/config.rb,
lib/pt_logger/version.rb
Defined Under Namespace
Classes: Logger
Constant Summary collapse
- VERSION =
"0.0.3"
Class Method Summary collapse
-
.log(*args) ⇒ Object
Command: log
message
to Pivotal Tracker. -
.log_if(condition, *args) ⇒ Object
Command: log
message
to Pivotal Tracker ifcondition
is true. -
.setup {|_self| ... } ⇒ Object
Default way to setup.
Class Method Details
.log(*args) ⇒ Object
Command: log message
to Pivotal Tracker.
The message
to log can the result of block evaluation:
log do
"evaluate the message to log here with implicit PT:999999 story id"
end
Or the message
to log can be passed as an arguent:
log()
An explicit story ID can be provided in both block and args form:
log(story_id) do
"evaluate the message to log here"
end
log(,story_id)
If story_id
is provided, logs to that story, else logs to a story ID referenced in the message itself (as #999 or PT:999).
Returns true if log was successful, else false. Supresses any StandardErrors that may occur during logging.
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/pt_logger/base.rb', line 29 def self.log(*args) if pt = PtLogger::Logger.new = block_given? ? yield : args.shift pt.append_story_note(,args.shift) else false end rescue false end |
.log_if(condition, *args) ⇒ Object
Command: log message
to Pivotal Tracker if condition
is true.
The message
to log can the result of block evaluation:
log_if(condition) do
"evaluate the message to log here with implicit PT:999999 story id"
end
Or the message
to log can be passed as an arguent:
log_if(condition,)
An explicit story ID can be provided in both block and args form:
log_if(condition,story_id) do
"evaluate the message to log here"
end
log_if(condition,,story_id)
If story_id
is provided, logs to that story, else logs to a story ID referenced in the message itself (as #999 or PT:999).
Returns true if log was successful, else false. Supresses any StandardErrors that may occur during logging.
66 67 68 69 70 |
# File 'lib/pt_logger/base.rb', line 66 def self.log_if(condition,*args) return false unless condition = block_given? ? yield : args.shift log(,*args) end |
.setup {|_self| ... } ⇒ Object
Default way to setup. Yields a block that gives access to all the config variables.
8 9 10 |
# File 'lib/pt_logger/config.rb', line 8 def self.setup yield self end |