Sidechair

log.info()

Browse the reference

Writes an informational message to the Pine Logs panel, with the bar it came from. Nothing is drawn on the chart.

Try it in the editor

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

Pine Script
log.info(message: series string) -> void
log.info(formatString: series string, arg0, arg1, ...: series int/float/bool/string/array<int/float/bool/string>) -> void

Arguments

NameTypeDefaultDescription
messageseries stringrequiredThe text written to the log. It is one string, so build it with str.tostring or str.format.
formatStringseries stringrequiredText containing placeholders {0}, {1} and so on, filled with the arguments that follow.
arg0series int/float/bool/string/array<int/float/bool/string>requiredThe value for {0} in the format string.
arg1series int/float/bool/string/array<int/float/bool/string>requiredThe value for {1} in the format string.
...series int/float/bool/string/array<int/float/bool/string>requiredMore 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.warning and log.error are 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

Pine ScriptLog a value on the last barOpen in editor
//@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