Jump to content

Tools.log

From CMM Wiki
Return to CMM Command Reference
Environment: Mission Scripting
Function: tools.log
Function Description: Logs a message to the dcs.log file with an optional severity level. The message can be a string, and the log type defaults to 'info' if not specified. Valid log types are 'info', 'warn', and 'error'. The function checks if logging is enabled and validates input types before outputting the message using the appropriate environment function.
File Location: cmm.tools.lua
Syntax: CMM.tools.log( string LogTXT , string LogType )
Return Value: nil
Parameters: Name Description
LogTXTMessage to log, must be a string. The message is written to the dcs.log file with the specified log type.
LogTypeOptional log type, defaults to 'info'. Valid options are 'info', 'warn', and 'error'. If not provided or invalid, defaults to CMM.tools.LogLevel or 'info'.
Example: CMM.tools.log("Unit movement detected", "warn")
Example Description: Logs a warning message indicating unit movement detection to the dcs.log file.
Related Functions:
Notes: