pyCloudy  0.9.6
manage Cloudy photoionization code
my_logging Class Reference

Logging tool. More...

Inherits object.

Public Member Functions

def __init__
 
def clean_log (self)
 
def debug
 
def message
 
def warn
 
def error
 
def timer
 
def print_messages (self)
 
def print_warnings (self)
 
def print_errors (self)
 
def print_timer (self)
 
def open_file (self, file_)
 
def close_file (self)
 

Public Attributes

 log_
 
 caller_max_size
 
 level
 
 calling
 
 print_time
 
 no_exit
 

Detailed Description

Logging tool.

Logging object that can log events with 3 different types (messages, warnings and error).
Date and time are save as well as the calling procedure.
events are printed in the standard output depending on the verbosity level.
level : -1: Quiet and no log into log_ variable
         0: Quiet
         1: Only Errors
         2: Errors and Warnings
         3: very verbose, print Errors, Warnings and Messages 
         4: debug

Constructor & Destructor Documentation

def __init__ (   self,
  level = None,
  calling = None,
  file_ = None,
  print_time = False,
  no_exit = True 
)
Parameters:
    - level [int] 0, 1, 2, 3, or 4
    - calling [str] description of the calling module
    - file_ [str] file to store the events (default is None).
    - print_time [boolean] if True, the event is printed with date-time (Default is False).

Member Function Documentation

def clean_log (   self)
def close_file (   self)
Close the output file and avoid printing to it.
def debug (   self,
  message,
  calling = None 
)
method to add a debug message to the log                
param:
    message [str] string to log
def error (   self,
  message,
  calling = None,
  exception = None 
)
method to add an error to the log
param:
    message [str] string to log
def message (   self,
  message,
  calling = None 
)
method to add a message to the log
param:
    message [str] string to log
def open_file (   self,
  file_ 
)
Open the file for the output and allow printing to it.
param:
    file_ [str] file to save the log events.
def print_errors (   self)
print all the errors.
def print_messages (   self)
print all the messages.
def print_timer (   self)
print the timer messages.
def print_warnings (   self)
print all the warnings.
def timer (   self,
  message,
  quiet = False,
  calling = None 
)
method to add a timer to the log. Print the time elapsed since last call of timer (or instanciation
of the object if first call).
param:
    message [str] string to log
    quiet [boolean] if True, no message printed (but timer reset)
def warn (   self,
  message,
  calling = None 
)
method to add a warning to the log                
param:
    message [str] string to log

Member Data Documentation

caller_max_size
calling
level
log_
no_exit
print_time