rfm2  22.0
A python-based rewrite of RenderMan for Maya
 All Classes Namespaces Files Functions Variables Pages
rfm2 Namespace Reference

Namespaces

 api
 
 cmdserver
 
 config
 
 constants
 
 extensions
 
 glue
 
 maya_node
 
 render
 
 renderer
 
 rfm_manipulators
 
 spool
 
 testpad
 
 txmanager_maya
 
 ui
 
 unit_tests
 
 utils
 
 vp
 
 vstructs
 
 xgen
 
 xgenExport
 
 xgenUI
 

Classes

class  MayaHandler
 

Functions

def clear_logging_prefs
 
def logging_prefs_values
 
def set_logger_level
 
def logger_level
 
def console_log_handler
 
def disk_log_handler
 
def set_disk_log_level
 
def disk_log_level
 
def disable_disk_logging
 
def set_console_log_level
 
def console_log_level
 
def init_log_level
 
def rfm_log
 
def get_logger
 
def init_xgen
 

Variables

list __all__
 
string LOG_LEVEL = 'rfmLogLevel'
 
string CONSOLE_LOG_LEVEL = 'rfmConsoleLogLevel'
 
string DISK_LOG_LEVEL = 'rfmDiskLogLevel'
 
int LOGGING_DISABLED = 100
 
 CRITICAL = logging.CRITICAL
 
 ERROR = logging.ERROR
 
 WARNING = logging.WARNING
 
 INFO = logging.INFO
 
int VERBOSE = 15
 
 DEBUG = logging.DEBUG
 
 NOTSET = logging.NOTSET
 
tuple __log__ = get_logger('rfm')
 

Detailed Description

rfm2 module init.

Sets up the module-wide logger and provides a number of utilities to control
the logging.

We are using logging levels:
 - logging.CRITICAL = 50    ->  MEL's error() or MGlobal.displayError()
 - logging.ERROR    = 40    ->  MEL's error() or MGlobal.displayError()
 - logging.WARNING  = 30    ->  MEL's warning() or MGlobal.displayWarning()
 - logging.INFO     = 20    ->  MEL's print() or MGlobal.displayInfo()
 - logging.VERBOSE  = 15    (this one is custom)
 - logging.DEBUG    = 10
 - logging.NOTSET   = 0

The logger has 2 handlers:
- One writes to maya's script editor
- The other writes to '~/rfm/logs/rfm.log'. The logs are limites to 10MB and
  there are up to 5 rotating logs.

Function Documentation

def rfm2.clear_logging_prefs ( )
Remove optionVars from maya prefs
def rfm2.console_log_handler ( )
Return the console handler

+ Here is the caller graph for this function:

def rfm2.console_log_level ( )
Return the current level of the console log handler

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def rfm2.disable_disk_logging ( )
Totally disable disk logging

+ Here is the call graph for this function:

def rfm2.disk_log_handler ( )
Return the rotating file handler

+ Here is the caller graph for this function:

def rfm2.disk_log_level ( )
Return the current level of the disk log handler

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def rfm2.get_logger (   name)
Return a logging.Logger() configured with 2 logging.Handler():
- A StreamHandler() handler for the console output.
- A RotatingFileHandler() to write the logs to disk.

Args:
- name (str): the logger's name. Once a logger has been created under a
              certain name, each subsequent creations with the same
              name will return the original instance.
def rfm2.init_log_level ( )
Read maya prefs (optionVars) to restore the previous logging levels when
a new session starts.

optionVars:
    - rfmLogLevel: The level of the logger. handlers will a lower level
      will not be called. Default to DEBUG.
    - rfmDiskLogLevel: The level of the handler that writes rotating
      logs to '~/rfm/logs/rfm.log'. Default to 100 (disabled).
    - rfmConsoleLogLevel: The level of the handler that writes to maya's
      scriptEditor panel. Defaul to INFO, which is maya's regular
      verbosity.

+ Here is the call graph for this function:

def rfm2.init_xgen ( )

+ Here is the call graph for this function:

def rfm2.logger_level ( )
Return the logger's current level

+ Here is the caller graph for this function:

def rfm2.logging_prefs_values ( )
Returns a of all logging prefs. the value is None if the optionVar
doesn't exist.
def rfm2.rfm_log ( )
Return RFM's logger object.

Why return the log object instead of defining utility functions like
logError(), logWarning(), etc ? Because the logger should be called at the
most relevant location in the code so that message formatting displays the
correct module and functions. Like so:

`2017-09-18 11:40:52,253  WARNING {MainThread}:  __init__ set_console_log_level: console log set to 20`

Usage:
    rfm_log().critical('My name is Inigo Montoya. You killed my father: prepare to die.')
    rfm_log().error('Inconceivable !')
    rfm_log().warning('Life isn't fair, it's just fairer than death, that's all.')
    rfm_log().info('When I was your age, television was called books.')
    rfm_log().log(rfm2.VERBOSE, 'did I tell you about my birthday ? well...')
    rfm_log().debug('un-expected value: what's wrong with the world !?')
def rfm2.set_console_log_level (   level)
Sets the level of the console log handler.

If the logger's level is below the requested level, the handler will not
be called, so we will adjust the logger's and console handler
accordingly.

The level can not be inferior to logging.WARNING.

args:
- level (logging level): a value between logging.NOTSET & logging.WARNING

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def rfm2.set_disk_log_level (   level)
Sets the level of the disk log handler.

If the logger's level is below the requested level, the handler will not
be called, so we will adjust the logger's and console handler
accordingly.

The level can be set to LOGGING_DISABLED (100) to disable disk logging.

args:
- level (logging level): a value between logging.NOTSET & logging.CRITICAL

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def rfm2.set_logger_level (   level)
Set RFM's global logger level.

+ Here is the caller graph for this function:

Variable Documentation

list rfm2.__all__
Initial value:
1 = ['api', 'config', 'extensions', 'maya_node', 'render', 'renderer',
2  'utils', 'ui', 'vp', 'txmanager_maya']
tuple rfm2.__log__ = get_logger('rfm')
string rfm2.CONSOLE_LOG_LEVEL = 'rfmConsoleLogLevel'
rfm2.CRITICAL = logging.CRITICAL
rfm2.DEBUG = logging.DEBUG
string rfm2.DISK_LOG_LEVEL = 'rfmDiskLogLevel'
rfm2.ERROR = logging.ERROR
rfm2.INFO = logging.INFO
string rfm2.LOG_LEVEL = 'rfmLogLevel'
int rfm2.LOGGING_DISABLED = 100
rfm2.NOTSET = logging.NOTSET
int rfm2.VERBOSE = 15
rfm2.WARNING = logging.WARNING