Module: RUtilAnts::Logging
- Defined in:
- lib/rUtilAnts/Logging.rb
Defined Under Namespace
Classes: Logger
Class Method Summary collapse
-
.initializeLogging(iLibRootDir, iBugTrackerURL, iSilentOutputs = false) ⇒ Object
Initialize the logging features.
Instance Method Summary collapse
-
#activateLogDebug(iDebugMode) ⇒ Object
Set the debug mode.
-
#debugActivated? ⇒ Boolean
Is debug mode activated ?.
-
#getBugTrackerURL ⇒ Object
Get the bug tracker URL.
-
#getLibRootDir ⇒ Object
Get the library root dir.
-
#getLogFile ⇒ Object
Get the log file used (can be nil).
-
#logBug(iMsg) ⇒ Object
Log a bug This is called when there is a bug in the program.
-
#logDebug(iMsg) ⇒ Object
Log a debugging info.
-
#logErr(iMsg) ⇒ Object
Log an error.
-
#logExc(iException, iMsg) ⇒ Object
Log an exception This is called when there is a bug due to an exception in the program.
-
#logInfo(iMsg) ⇒ Object
Log an info.
-
#logMsg(iMsg) ⇒ Object
Log a normal message to the user This is used to display a simple message to the user.
-
#logWarn(iMsg) ⇒ Object
Log a warning.
-
#muteStdErr(iMute = true) ⇒ Object
Mute or unmute error output.
-
#muteStdOut(iMute = true) ⇒ Object
Mute or unmute standard output.
-
#setGUIForDialogs(iGUIToUse) ⇒ Object
Indicate which GUI to be used to display dialogs.
-
#setLogErrorsStack(iErrorsStack) ⇒ Object
Set the stack of the errors to fill.
-
#setLogFile(iFileName) ⇒ Object
Set the log file to use (can be nil to stop logging into a file).
-
#setLogMessagesStack(iMessagesStack) ⇒ Object
Set the stack of the messages to fill.
Class Method Details
.initializeLogging(iLibRootDir, iBugTrackerURL, iSilentOutputs = false) ⇒ Object
Initialize the logging features
Parameters:
-
iLibRootDir (String): The library root directory that will not appear in the logged stack messages
-
iBugTrackerURL (String): The application’s bug tracker URL, used to report bugs
-
iSilentOutputs (Boolean): Do we silent outputs (nothing sent to $stdout or $stderr) ? [optional = false]
411 412 413 414 415 |
# File 'lib/rUtilAnts/Logging.rb', line 411 def self.initializeLogging(iLibRootDir, iBugTrackerURL, iSilentOutputs = false) $rUtilAnts_Logging_Logger = RUtilAnts::Logging::Logger.new(iLibRootDir, iBugTrackerURL, iSilentOutputs) # Add the module accessible from the Object namespace Object.module_eval('include RUtilAnts::Logging') end |
Instance Method Details
#activateLogDebug(iDebugMode) ⇒ Object
Set the debug mode
Parameters:
-
iDebugMode (Boolean): Are we in debug mode ?
477 478 479 |
# File 'lib/rUtilAnts/Logging.rb', line 477 def activateLogDebug(iDebugMode) $rUtilAnts_Logging_Logger.activateLogDebug(iDebugMode) end |
#debugActivated? ⇒ Boolean
Is debug mode activated ?
Return:
-
Boolean: Are we in debug mode ?
485 486 487 |
# File 'lib/rUtilAnts/Logging.rb', line 485 def debugActivated? return $rUtilAnts_Logging_Logger.debugActivated? end |
#getBugTrackerURL ⇒ Object
Get the bug tracker URL
Return:
-
String: The bug tracker URL, as defined when initialized
461 462 463 |
# File 'lib/rUtilAnts/Logging.rb', line 461 def getBugTrackerURL return $rUtilAnts_Logging_Logger.getBugTrackerURL end |
#getLibRootDir ⇒ Object
Get the library root dir
Return:
-
String: The library root dir, as defined when initialized
453 454 455 |
# File 'lib/rUtilAnts/Logging.rb', line 453 def getLibRootDir return $rUtilAnts_Logging_Logger.getLibRootDir end |
#getLogFile ⇒ Object
Get the log file used (can be nil)
Return:
-
String: Log file name (can be nil)
445 446 447 |
# File 'lib/rUtilAnts/Logging.rb', line 445 def getLogFile return $rUtilAnts_Logging_Logger.getLogFile end |
#logBug(iMsg) ⇒ Object
Log a bug This is called when there is a bug in the program. It has been set in many places to detect bugs.
Parameters:
-
iMsg (String): Message to log
524 525 526 |
# File 'lib/rUtilAnts/Logging.rb', line 524 def logBug(iMsg) $rUtilAnts_Logging_Logger.logBug(iMsg) end |
#logDebug(iMsg) ⇒ Object
Log a debugging info. This is used when debug is activated
Parameters:
-
iMsg (String): Message to log
569 570 571 |
# File 'lib/rUtilAnts/Logging.rb', line 569 def logDebug(iMsg) $rUtilAnts_Logging_Logger.logDebug(iMsg) end |
#logErr(iMsg) ⇒ Object
Log an error. Those errors can be normal, as they mainly depend on external factors (lost connection, invalid user file…)
Parameters:
-
iMsg (String): Message to log
533 534 535 |
# File 'lib/rUtilAnts/Logging.rb', line 533 def logErr(iMsg) $rUtilAnts_Logging_Logger.logErr(iMsg) end |
#logExc(iException, iMsg) ⇒ Object
Log an exception This is called when there is a bug due to an exception in the program. It has been set in many places to detect bugs.
Parameters:
-
iException (Exception): Exception
-
iMsg (String): Message to log
515 516 517 |
# File 'lib/rUtilAnts/Logging.rb', line 515 def logExc(iException, iMsg) $rUtilAnts_Logging_Logger.logExc(iException, iMsg) end |
#logInfo(iMsg) ⇒ Object
Log an info. This is just common journal.
Parameters:
-
iMsg (String): Message to log
551 552 553 |
# File 'lib/rUtilAnts/Logging.rb', line 551 def logInfo(iMsg) $rUtilAnts_Logging_Logger.logInfo(iMsg) end |
#logMsg(iMsg) ⇒ Object
Log a normal message to the user This is used to display a simple message to the user
Parameters:
-
iMsg (String): Message to log
542 543 544 |
# File 'lib/rUtilAnts/Logging.rb', line 542 def logMsg(iMsg) $rUtilAnts_Logging_Logger.logMsg(iMsg) end |
#logWarn(iMsg) ⇒ Object
Log a warning. Warnings are not errors but still should be highlighted.
Parameters:
-
iMsg (String): Message to log
560 561 562 |
# File 'lib/rUtilAnts/Logging.rb', line 560 def logWarn(iMsg) $rUtilAnts_Logging_Logger.logWarn(iMsg) end |
#muteStdErr(iMute = true) ⇒ Object
Mute or unmute error output
Parameters:
-
iMute (Boolean): Do we mute error output ? [optional = true]
429 430 431 |
# File 'lib/rUtilAnts/Logging.rb', line 429 def muteStdErr(iMute = true) $rUtilAnts_Logging_Logger.muteStdErr(iMute) end |
#muteStdOut(iMute = true) ⇒ Object
Mute or unmute standard output
Parameters:
-
iMute (Boolean): Do we mute standard output ? [optional = true]
421 422 423 |
# File 'lib/rUtilAnts/Logging.rb', line 421 def muteStdOut(iMute = true) $rUtilAnts_Logging_Logger.muteStdOut(iMute) end |
#setGUIForDialogs(iGUIToUse) ⇒ Object
Indicate which GUI to be used to display dialogs.
Parameters:
-
iGUIToUse (Integer): The GUI constant, or nil if no GUI is provided
469 470 471 |
# File 'lib/rUtilAnts/Logging.rb', line 469 def setGUIForDialogs(iGUIToUse) $rUtilAnts_Logging_Logger.setGUIForDialogs(iGUIToUse) end |
#setLogErrorsStack(iErrorsStack) ⇒ Object
Set the stack of the errors to fill. If set to nil, errors will be displayed as they appear. If set to a stack, errors will silently be added to the list.
Parameters:
-
iErrorsStack (list<String>): The stack of errors, or nil to unset it
495 496 497 |
# File 'lib/rUtilAnts/Logging.rb', line 495 def setLogErrorsStack(iErrorsStack) $rUtilAnts_Logging_Logger.setLogErrorsStack(iErrorsStack) end |
#setLogFile(iFileName) ⇒ Object
Set the log file to use (can be nil to stop logging into a file)
Parameters:
-
iFileName (String): Log file name (can be nil)
437 438 439 |
# File 'lib/rUtilAnts/Logging.rb', line 437 def setLogFile(iFileName) $rUtilAnts_Logging_Logger.setLogFile(iFileName) end |
#setLogMessagesStack(iMessagesStack) ⇒ Object
Set the stack of the messages to fill. If set to nil, messages will be displayed as they appear. If set to a stack, messages will silently be added to the list.
Parameters:
-
iMessagesStack (list<String>): The stack of messages, or nil to unset it
505 506 507 |
# File 'lib/rUtilAnts/Logging.rb', line 505 def setLogMessagesStack(iMessagesStack) $rUtilAnts_Logging_Logger.setLogMessagesStack(iMessagesStack) end |