A monte carlo pin cell spectral code for nuclear engineering applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
pinspec.log Namespace Reference

Utility functions for writing log messages to the screen. More...

Functions

def py_printf
 Function to print a log message to the screen. More...
 
def py_set_log_level
 Assigns the lowest level logging message. More...
 

Detailed Description

Utility functions for writing log messages to the screen.

This module includes a set of wrapper functions for the logging routines provided by PINSPEC's C++ source code. These Python methods provide an interface for creating formatted log messages using level-based loggin and to print them to the screen as well as a logfile.

Author
Samuel Shaner
Date
March 15, 2013

Function Documentation

def pinspec.log.py_printf (   level,
  my_str,
  args 
)

Function to print a log message to the screen.

This method is a wrapper to the log_printf C++ routine. It allows for formatted messages to be printed to the screen in a similar fashion to the C/C++ printf method, but with additional formatting provided by the PINSPEC logging utilities. An example of how this might be used in a PINSPEC Python script is as follows:

1 value1 = 25
2 value2 = 26.0
3 log.py_printf('NORMAL', 'My name is Will and I am %d going on'\
4  ' %f years of age', value1, value2)
Parameters
levelthe logging level for this message
my_strthe string to print to the screen
*argsa variable length list of values for the message string
def pinspec.log.py_set_log_level (   level)

Assigns the lowest level logging message.

Sets the lowest level logging message to print to the screen. This controls the lowest level for both logging messages in the C++ source code as well as the user's PINSPEC Python input file. This function would be called at the beginning of the input file as follows:

1 log.py_setlevel('INFO')
Parameters
levelthe minimum logging level ('DEBUG', 'INFO', etc)