NinjaScript > Language Reference > Alert & Debug >

Log()

Print this Topic Previous pageReturn to chapter overviewNext page

Definition

Generates log output to the NinjaTrader Control Center window Log tab.

 

NOTE: Each call to this method creates a log entry which takes memory to keep loaded in the Log tab of the Control Center. Excessive logging can result in huge portions of memory being allocated to display the log messages. Please see the NinjaScript section of the Performance Tips article for more information.

 

Syntax

Log(string message, LogLevel logLevel)

 

Parameters

message

Alert message

logLevel

Sets the message level for the log event. Different levels are color coded in the NinjaTrader log.
 
NinjaTrader.Cbi.LogLevel.Alert (will also generate a pop up message window with log text)
NinjaTrader.Cbi.LogLevel.Error

NinjaTrader.Cbi.LogLevel.Information

NinjaTrader.Cbi.LogLevel.Warning

 

 

Examples

// Generates a log message
Log("This is a log message", NinjaTrader.Cbi.LogLevel.Information);

 

// Generates a log message with a notification window

Log("This will generate a notification window as well", NinjaTrader.Cbi.LogLevel.Alert);