Log
Outputs logs.
Log(...msgs)Examples
-
Multiple
msgparameters can be passed in.javascriptfunction main() { Log("msg1", "msg2", "msg3") }pythondef main(): Log("msg1", "msg2", "msg3")rustfn 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.javascriptfunction 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@") }pythondef main(): Log("Hello FMZ Quant !@") Sleep(1000 * 5) Log("Hello, #ff0000@")rustfn 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 printingbase64-encoded images. The content starts with`and ends with`, for example.javascriptfunction main() { Log("`data:image/png;base64,AAAA`") }pythondef main(): Log("`data:image/png;base64,AAAA`")rustfn main() { Log!("`data:image/png;base64,AAAA`"); } -
The
Log()function supports directly printingPython'smatplotlib.pyplotobject. As long as the object contains asavefigmethod, it can be printed directly using theLogfunction, for example.pythonimport 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.javascriptfunction main() { Log("[trans]中文|abc[/trans]") }pythondef main(): Log("[trans]中文|abc[/trans]")rustfn main() { Log!("[trans]中文|abc[/trans]"); }
Arguments
| Name | Type | Required | Description |
msg | string / number / bool / object / array / any | No | The parameter |
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.