Palette:logger

From Derivative
Jump to navigation Jump to search

Summary
[edit]

Starting with the first build released publicly on the 2023.10k branch, TouchDesigner now comes with its own Logger COMP.

For more details about logging in TouchDesigner, please visit the Logger page.

The Logger COMP is a wrapper around the Python Logging Library, and comes as an interface to add additional Loggers easily in your TouchDesigner projects, while relying (or not) on the TDAppLogger internally shipping with TouchDesigner.

Logging can come at a performance cost when used inefficiently. Users should visit this page which applies to TouchDesigner as well.

The easiest way to use the Logger COMP within your own components is by drag n dropping a Logger COMP in your custom component and by referencing the Logger COMP as a COMP Parameter to be used internally, or better, by assigning the Logger COMP to a member in a custom python extension.

From within your scripts, you can call logger.Error('Some Error Message'), logger.Warning('Some Warning Message')… etc.

See the Logger Extension page to have a list of exposed members and methods.

By default, the Logger COMP will be parented to an internal Logger that comes shipped with TouchDesigner, named TDAppLogger.

For general purpose logging, users don’t have to use a new Logger COMP, you can simply use the TDAppLogger by accessing it using op.TDResources.TDAppLogger. Again, refer to the Logger extension page to get a better idea of which members and methods are exposed.

If you rather have a more custom approach, or rely on the hierarchical structure of the Python logging library, then use the Logger COMP.

Note that when tuning the Logger COMP parameters, it will often occur that a logger instance (read, the Python logger object) gets destroyed and re-created. Similarly, some Python logging handlers might be destroyed and re-created to follow the new Logger COMP parameters.

If you are actively logging messages while tweaking those parameters, issues might occur. While not necessary for all cases, it is advised to turn off the Active parameter first.

For advanced Python users, the actual Python Logger object is exposed via the loggerCOMP.Logger member.

PythonIcon.pngPalette:logger Ext


Parameters - Settings Page

Active Active - When the active flag is turned off, most logging messages will be silenced and log levels are ignored.

Parent Logger Parentlogger - The Logger COMP to which this Logger COMP is currently parented. Parenting allow for logging messages to be passed up to any handler associated with a parent. When using parenting, it is possible to see duplicates records in the textport if the records are being propagated as well as being logged to textport.

Propagate to parent(s) Propagate - When using parenting, use this toggle if you wish to prevent messages from being passed to the parent.

Open Parameters Dialog Openparametersdialog - Open a floating window of the parameters dialog.

General Settings Generalsettings -

Origin Origin - Reference a COMP for the logger to mention where the log messages are originating from.

Log Level Loglevel - - Filter level of logging messages. The selected level is included as well as all levels above. I.e. if Warning is selected, Warning and Error messages will be included while Info messages will be excluded.

  • INFO INFO -
  • DEBUG DEBUG -
  • WARNING WARNING -
  • ERROR ERROR -
  • CRITICAL CRITICAL -

Log App Errors (from Error DAT) Logapperrors - Use an internal Error DAT which filters any messages matching the Origin and Log Level.

Log to Textport Logtotextport - When enabled, logging messages will be displayed in the textport.

Log to Status Bar Logtostatusbar - When enabled, logging messages will be displayed in the status bar.

File Logger Settings Fileloggersettings -

Logger Name Loggername - The name of the Logger instance. This is reflected in the logging messages when multiple loggers are passing messages to a parent and being processed by the same handler.

Log to File Logtofile - When enabled, logging messages will be written to a time rotated log file.

Log Folder Logfolder - Path to the folder in which the log files should be written.

Open Log Folder Openlogfolder - Open the folder to which the .log file is present. The folder opened isn't necesarily the folder set in the Log Folder parameter, if file logging is disabled but a parent logger with a file handler is assigned.

Path To Log File Pathtologfile - When a parameter of the current Logger COMP gets changed, it can have an impact on the current log file path.

When the current logger doesn't have file logging turned on, it doesn't mean that the log messages are not passed to a file. The messages could be passed to a parent logger which itself will have a file handler. Internally the Logger COMP attempts to find the path to a parent logger file handler and the path would be filled automatically here.

Add PID to file name Addpidtofilename - This will add the current process PID to the file name. This can be useful to split log files originating from the same project but ran in multiple processes.

Open Log File Openlogfile - Open the current log file. Similarly to the Open Log Folder parameter, the log to file parameter doesn't have to be turned on to open the log file. A log file might be currently used by the Logger COMP if a handler is present on a parent logger.

File Rotation Filerotation - Number of backup files to be kept when rotating log.

Callback Callback -

Callback DAT Callbackdat - A DAT with a onMessageLogged(info) method.

Create Callback DAT Createcallbackdat - Create a valid callback DAT from the template shipping with the COMP.

Print Callbacks Printcallbacks - Print the callback details to the textport.


Parameters - About Page

Help Help -

Version Version -

.tox Save Build Toxsavebuild -

TouchDesigner Build:

Palette
Palette • Palette:arcBallCamera • Palette:arcBallGeometry • Palette:audioAnalysis • Palette:audioSet • Palette:battery • Palette:bitwigClip • Palette:bitwigClipSlot • Palette:bitwigDeviceRemotes • Palette:bitwigMain • Palette:bitwigNote • Palette:bitwigProjectRemotes • Palette:bitwigRemotesDevice • Palette:bitwigRemotesProject • Palette:bitwigRemotesTrack • Palette:bitwigSelect • Palette:bitwigSong • Palette:bitwigTrack • Palette:bitwigTrackRemotes • Palette:blendModes • Palette:bloom • Palette:camera • Palette:cameraBrowser • Palette:cameraViewport • Palette:camSchnappr • Palette:changeColor • Palette:changeToColor • Palette:checker • Palette:chromaKey • Palette:colorThreshold • Palette:compareComp • Palette:convolve • Palette:cornerPinSOP • Palette:cppParsTemplateGen • Palette:customAttributes • Palette:debugControl • Palette:dent • Palette:depthExtract • Palette:dilate • Palette:encoder • Palette:equalizer • Palette:feedback • Palette:feedbackEdge • Palette:firmata • Palette:gal • Palette:geoPanel • Palette:gestureCapture • Palette:graphPlot • Palette:histogram • Palette:hsvBlur • Palette:imageSearch • Palette:julia • Palette:kantanMapper • Palette:kinectCalibration • Palette:kinectPointcloud • Palette:leapPaint • Palette:lightTunnel • Palette:logger • Palette:mandelbrot • Palette:materialDesignIcons • Palette:mesh • Palette:monochrome • Palette:motionSense • Palette:movieEngine • Palette:moviePlayer • Palette:moviePlaylist • Palette:multiLevel • Palette:multiMix • Palette:noise • Palette:onScreenKeyboard • Palette:operatorPath • Palette:opticalFlow • Palette:pixelate • Palette:pixelRelocator • Palette:pointGenerator • Palette:pointillize • Palette:pointMerge • Palette:pointRender • Palette:pointRepack • Palette:pointTransform • Palette:pointWeight • Palette:popDialog • Palette:probe • Palette:projectorBlend • Palette:pushPins • Palette:puzzle • Palette:quadReproject • Palette:radialBlur • Palette:recorder • Palette:remotePanel • Palette:rgbaBlur • Palette:rgbaDelay • Palette:rgbContrast • Palette:sceneChanger • Palette:search • Palette:searchReplace • Palette:sharpen • Palette:sickEngine • Palette:signalingClient • Palette:signalingServer • Palette:softenAlpha • Palette:solarize • Palette:sopRender • Palette:splitter • Palette:stitcher • Palette:stoner • Palette:superFormula • Palette:SVG • Palette:sweetSpot • Palette:sweetSpotPreviz • Palette:synchroCache • Palette:synchroClient • Palette:synchroFrameIn • Palette:synchroFrameOut • Palette:synchroNDIIn • Palette:synchroSDIIn • Palette:synchroVideoOut • Palette:tdBitwigPackage • Palette:TDVR • Palette:testGrid • Palette:transitMap • Palette:twirl • Palette:vectorScope • Palette:virtualFile • Palette:waveformMonitor • Palette:webBrowser • Palette:webRTC • Palette:webRTCPanel • Palette:webRTCPanelRcv • Palette:xyScope