Type/to search
Built-in Functions
Global
Log
Log
LogStatus
LogProfit
LogProfitReset
LogReset
LogVacuum
EnableLog
Chart
KLineChart
console.log
console.error
exchange.Log
Market
Trade
Account
Futures
Exchange
IO
Network
Storage
Threads
TA
Talib
OS
Structures
Built-in Variables and Constants
Conventions
Exchanges

Outputs logs.

Log(...msgs)

Examples

  • Multiple msg parameters can be passed in.

    javascript
    function main() { Log("msg1", "msg2", "msg3") }
    python
    def main(): Log("msg1", "msg2", "msg3")
    rust
    fn main() { Log!("msg1", "msg2", "msg3"); }
  • Setting the color of the output message is supported. If you need to set both the color and push simultaneously, set the color first and then use the @ character to set push at the end.

    javascript
    function main() { Log("Hello FMZ Quant !@") Sleep(1000 * 5) // Adding #ff0000 within the string makes the printed log display in red and pushes the message Log("Hello, #ff0000@") }
    python
    def main(): Log("Hello FMZ Quant !@") Sleep(1000 * 5) Log("Hello, #ff0000@")
    rust
    fn main() { Log!("Hello FMZ Quant !@"); Sleep(1000 * 5); // Adding #ff0000 within the string makes the printed log display in red and pushes the message Log!("Hello, #ff0000@"); }
  • The Log() function supports printing base64-encoded images. The content starts with ` and ends with `, for example.

    javascript
    function main() { Log("`data:image/png;base64,AAAA`") }
    python
    def main(): Log("`data:image/png;base64,AAAA`")
    rust
    fn main() { Log!("`data:image/png;base64,AAAA`"); }
  • The Log() function supports directly printing Python's matplotlib.pyplot object. As long as the object contains a savefig method, it can be printed directly using the Log function, for example.

    python
    import matplotlib.pyplot as plt def main(): plt.plot([3,6,2,4,7,1]) Log(plt)
  • The Log() function supports language switching. Its output text will automatically switch to the corresponding language according to the language setting of the platform page, for example.

    javascript
    function main() { Log("[trans]中文|abc[/trans]") }
    python
    def main(): Log("[trans]中文|abc[/trans]")
    rust
    fn main() { Log!("[trans]中文|abc[/trans]"); }

Arguments

NameTypeRequiredDescription

msg

string / number / bool / object / array / any

No

The parameter msg is the content to be output. Multiple msg parameters can be passed in.

See Also

Remarks

The Log() function outputs a log message to the log area of the live trading or backtesting system. During live trading, the logs will be saved in the live trading database. If the content output by the Log() function ends with the @ character, that log will enter the message push queue and be pushed to the email address, WebHook address, etc. configured in the Push Settings of the current FMZ Quant Trading Platform account. The Debugging Tool and the backtesting system do not support message push. Message push is subject to frequency limits, with the specific rules as follows: multiple push messages produced by a live trading within one status reporting cycle (about 20 seconds) are merged into a single push, adjacent duplicate lines are folded into the form content ×N, and the merged push is limited to 4096 bytes, with any excess truncated and the truncated amount noted; each platform account can send at most 50 pushes per hour, and pushes beyond that are not sent; the body of each push keeps at most 200 characters (the push logs output via the Log function are still printed and displayed normally in the log area).

If the content output by the Log() function ends with the & character, that log will be marked as a private log. When the live trading is publicly displayed, that log is hidden from other users, but remains visible from the perspective of the live trading owner's account. This feature can be used to record sensitive information such as API keys, account balances, etc. For example: Log("Private information", "&").

How to set up push channels (email, WebHook, etc.) and the format of WebHook requests are described in the User Guide: Platform Basics → Live Trading → Live Trading Message Push.