pymel.core.general.commandLogging

commandLogging(*args, **kwargs)

This command controls logging of Maya commands, in memory and on disk. Note that if commands are logged in memory, they will be available to the crash reporter and appear in crash logs. In query mode, return type is based on queried flag.

Flags:

Long Name / Short Name Argument Types Properties
historySize / hs int ../../../_images/create.gif ../../../_images/query.gif
  Sets the number of entries in the in-memory command history.
logCommands / lc bool ../../../_images/create.gif ../../../_images/query.gif
  Enables or disables the on-disk logging of commands.
logFile / lf unicode ../../../_images/create.gif ../../../_images/query.gif
  Sets the filename to use for the on-disk log. If logging is active, the current file will be closed before the new one is opened.
recordCommands / rc bool ../../../_images/create.gif ../../../_images/query.gif
  Enables or disables the in-memory logging of commands.
resetLogFile / rl bool ../../../_images/create.gif ../../../_images/query.gif
  Reset the log filename to the default (‘mayaCommandLog.txt’ in the application folder, alongside ‘Maya.env’ and the default projects folder). Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.commandLogging

Example:

::

import pymel.core as pm

# Set the number of commands logged in memory to 20 # pm.commandLogging( historySize=20 )

# Query the number of commands being logged in memory # pm.commandLogging( q=True, historySize=True ) # Result: 20 # # Result: 20

# Query the log file location # pm.commandLogging( q=True, logFile=True ) # Result: u’C:/Users/paulm/maya_pymel_test/mayaCommandLog.txt’ # # Result: C:/Users/foobar/Documents/maya/mayaCommandLog.txt

# Change the log file location # pm.commandLogging( logFile=’C:/temp/log.txt’ )

# Reset the log file to default # pm.commandLogging( resetLogFile=True )