Writes an informational message to the Pine Logs panel, with the bar it came from. Nothing is drawn on the chart.
log.info(message) adds a line to the script's log at the information level. The second form, log.info(formatString, arg0, arg1, ...), fills numbered placeholders in the format string with the arguments: log.info("close = {0}, volume = {1}", close, volume). Each line is stamped with the time of the bar that wrote it.
Use it to follow how a value changes bar by bar while you build a script, or to record why a branch was taken. It does not affect the script's result, and calling it on every bar can fill the log quickly, so guard it with a condition or barstate.islast.
Syntax
log.info(message: series string) -> void
log.info(formatString: series string, arg0, arg1, ...: series int/float/bool/string/array<int/float/bool/string>) -> voidArguments
| Name | Type | Default | Description |
|---|---|---|---|
| message | series string | required | The text written to the log. It is one string, so build it with str.tostring or str.format. |
| formatString | series string | required | Text containing placeholders {0}, {1} and so on, filled with the arguments that follow. |
| arg0 | series int/ | required | The value for {0} in the format string. |
| arg1 | series int/ | required | The value for {1} in the format string. |
| ... | series int/ | required | More values for {2}, {3} and so on. Numbers, bools, strings and arrays of them are accepted. |
Returns
Nothing.
Remarks
- Log lines are for the person writing the script, and they are not shown on the chart or sent in alerts.
log.warningandlog.errorare the same call at the other levels. - A placeholder that has no matching argument is printed as written.
- On Sidechair: the Pine Logs panel keeps the newest 10,000 lines from history and the newest 5,000 from live bars.
Example
//@version=6
indicator("Log last close")
plot(close, "Close", color.blue)
if barstate.islast
log.info("close = {0}, volume = {1}", close, volume)See also
Runs on Sidechair