File SMLogger.mys

Logging utility, prints informations or error to console and log file.

You can choose the levels to print, i.e. only warnings and errors and ignore infos and debug.
In Harmony > 9.9.6c, the level is automatically set to info or debug if you run the script from the menu or the editor.

Summary

ConstantTypeSummary
LOG_FILEstringOutput also in a file?
LOG_LEVELintLogging level for your script
LOG_LEVEL_DEBUGintLogging level: debug
LOG_LEVEL_ERRORintLogging level: error
LOG_LEVEL_INFOintLogging level: info
LOG_LEVEL_TRACEintLogging level: trace, a more detailled debug
LOG_LEVEL_WARNintLogging level: warning
Return typeFunction and summary
 debug(string text)
Log debugging informations.
 err(string text)
Log error This print "ERROR "..text to the console.
 info(string text)
Log informations.
 trace(string text)
Log trace-debugging informations.
 warn(string text)
Log warning This print "WARN "..text to the console.

Constants

string LOG_FILE

Output also in a file?

Set LOG_FILE to a filename if you want so. Log lines older than 30 days are automatically deleted to avoid endless growth of the file.

int LOG_LEVEL_TRACE

Logging level: trace, a more detailled debug

int LOG_LEVEL_DEBUG

Logging level: debug

int LOG_LEVEL_INFO

Logging level: info

int LOG_LEVEL_WARN

Logging level: warning

int LOG_LEVEL_ERROR

Logging level: error

int LOG_LEVEL

Logging level for your script

Functions

trace(string text)

Log trace-debugging informations.

This allow you to keep logging in your script, even if shared with Myriad community.

This print "TRACE "..text to the console.

If you often use print and comment all these prints before sharing, this will save you time!

ParameterTypeDefaultDescription
textstring  

debug(string text)

Log debugging informations.

This allow you to keep logging in your script, even if shared with Myriad community.

This print "DEBUG "..text to the console.

If you often use print and comment all these prints before sharing, this will save you time!

ParameterTypeDefaultDescription
textstring  

info(string text)

Log informations.

This print "INFO "..text to the console.

ParameterTypeDefaultDescription
textstring  

warn(string text)

Log warning This print "WARN "..text to the console.

ParameterTypeDefaultDescription
textstring  

err(string text)

Log error This print "ERROR "..text to the console.

ParameterTypeDefaultDescription
textstring  
See
throw