rfm2  22.0
A python-based rewrite of RenderMan for Maya
rfm2 Namespace Reference

Namespaces

 api
 
 cmdserver
 
 config
 
 constants
 
 extensions
 
 glue
 
 maya_node
 
 render
 
 render_setup
 
 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 (level)
 
def logger_level ()
 
def console_log_handler ()
 
def disk_log_handler ()
 
def set_disk_log_level (level)
 
def disk_log_level ()
 
def disable_disk_logging ()
 
def set_console_log_level (level)
 
def console_log_level ()
 
def init_log_level ()
 
def rfm_log ()
 
def get_logger (name)
 
def init_xgen ()
 
def render_with_renderman ()
 
def using_renderman ()
 

Variables

string LOG_LEVEL = 'rfmLogLevel'
 
string CONSOLE_LOG_LEVEL = 'rfmConsoleLogLevel'
 
string DISK_LOG_LEVEL = 'rfmDiskLogLevel'
 
string BATCH_LOG_ENV_VAR = 'RFM_BATCH_LOG_LEVEL'
 
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
 

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.

In batch mode, the log level can be overriden via the RFM_BATCH_LOG_LEVEL
environment variable. Just set it to DEBUG, VERBOSE, INFO, WARNING, ERROR or
CRITICAL, like so:

    export RFM_BATCH_LOG_LEVEL=VERBOSE

Any other value will be reported via a warning and ignored.

Function Documentation

◆ clear_logging_prefs()

def rfm2.clear_logging_prefs ( )
Remove optionVars from maya prefs

◆ console_log_handler()

def rfm2.console_log_handler ( )
Return the console handler
+ Here is the caller graph for this function:

◆ console_log_level()

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:

◆ disable_disk_logging()

def rfm2.disable_disk_logging ( )
Totally disable disk logging
+ Here is the call graph for this function:

◆ disk_log_handler()

def rfm2.disk_log_handler ( )
Return the rotating file handler
+ Here is the caller graph for this function:

◆ disk_log_level()

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:

◆ get_logger()

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.
+ Here is the caller graph for this function:

◆ init_log_level()

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.

Maya batch mode override:
    You can define the RFM_BATCH_LOG_LEVEL environment variable and set it
    to one of the predefined log levels, like so:

        export RFM_BATCH_LOG_LEVEL=VERBOSE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_xgen()

def rfm2.init_xgen ( )
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ logger_level()

def rfm2.logger_level ( )
Return the logger's current level
+ Here is the caller graph for this function:

◆ logging_prefs_values()

def rfm2.logging_prefs_values ( )
Returns a of all logging prefs. the value is None if the optionVar
doesn't exist.

◆ render_with_renderman()

def rfm2.render_with_renderman ( )
Switches the current renderer to RenderMan if need be.
+ Here is the caller graph for this function:

◆ rfm_log()

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().verbose('did I tell you about my birthday ? well...')
    rfm_log().debug('un-expected value: what's wrong with the world !?')

◆ set_console_log_level()

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:

◆ set_disk_log_level()

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:

◆ set_logger_level()

def rfm2.set_logger_level (   level)
Set RFM's global logger level.
+ Here is the caller graph for this function:

◆ using_renderman()

def rfm2.using_renderman ( )
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ BATCH_LOG_ENV_VAR

string rfm2.BATCH_LOG_ENV_VAR = 'RFM_BATCH_LOG_LEVEL'

◆ CONSOLE_LOG_LEVEL

string rfm2.CONSOLE_LOG_LEVEL = 'rfmConsoleLogLevel'

◆ CRITICAL

rfm2.CRITICAL = logging.CRITICAL

◆ DEBUG

rfm2.DEBUG = logging.DEBUG

◆ DISK_LOG_LEVEL

string rfm2.DISK_LOG_LEVEL = 'rfmDiskLogLevel'

◆ ERROR

rfm2.ERROR = logging.ERROR

◆ INFO

rfm2.INFO = logging.INFO

◆ LOG_LEVEL

string rfm2.LOG_LEVEL = 'rfmLogLevel'

◆ LOGGING_DISABLED

int rfm2.LOGGING_DISABLED = 100

◆ NOTSET

rfm2.NOTSET = logging.NOTSET

◆ VERBOSE

int rfm2.VERBOSE = 15

◆ WARNING

rfm2.WARNING = logging.WARNING