# Algorithm Reference

## Logging and Debug

Contents

### Debug Messages

Algorithms can send debug messages to the console using the Debug(string message) method. Debug messages are capped at 200 characters long. If multiple identical messages are sent within 1 second we rate limit the messages to avoid crashing your browser.

Debug(Time.ToString("o") + " Purchasing AAPL: " + data["AAPL"].Price);

self.Debug(str(self.Time) + " Purchasing AAPL: " + str(slice["SPY"].Price))

this.Debug("Hello from FSharp")


### Errors Messages

Algorithms can send error messages to the console using the Error(string message) method. Error messages appear red in the console so you can see them easily. Like debug messages, error messages are rate limited to avoid flooding your browser.

Error("Volatility too high, terminating algorithm.");
Quit(); //Option: Instruct algorithm to stop.

self.Error("Volatility too high, terminating algorithm.")
self.Quit() # Optional: Instruct algorithm to stop.

this.Error("Volatility too high, triggering exit")
this.Quit()


### Logging

Algorithms can save more detailed messaging to log files for later analysis using Log(string message). At the end of the backtest a link will be presented to view your results. In live trading a log viewer lets you view log results while the algorithm is running. Because of data vendor limitations price information cannot be recorded in logs.

If multiple identical messages are sent they are filtered out. You can intentionally bypass this by adding a timestamp to your log messages.

Because of vendor limitations free users are capped to 10kb of logs per backtest, with a maximum of 3Mb per day. Users with a subscription can generate up to 100kb of logs per backtest.

Log("Additional detailed logging messages");

self.Log("Additional detailed logging messages")

this.Log("Additional detailed logging messages")


You can also see our Tutorials and Videos. You can also get in touch with us via Chat.