Difference between revisions of "Bot Playground/Built-in Functions/console.log"

From SmartBots Developers Docs
Jump to: navigation, search
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
 
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
<onlyinclude>Logs data to the [[../../Logging|runtime log]].</onlyinclude>
+
<onlyinclude>Logs data to the runtime log.</onlyinclude> Read more about [[../../Logging|runtime logs]].
  
 
<syntaxhighlight lang="javascript">
 
<syntaxhighlight lang="javascript">
Line 16: Line 16:
 
{{API Variables Table End}}
 
{{API Variables Table End}}
  
== Examples ==
+
== Important notice ==
  
 +
Since logs are being saved in asynchronous way, '''consecutive''' console.log() may shuffle:
 +
 +
<syntaxhighlight lang="javascript">
 +
console.log("line 1");
 +
console.log("line 2");
 +
</syntaxhighlight>
 +
 +
may generate the following under a heavy load:
 +
 +
13/6/2016 22:25:50
 +
line 2
 +
 +
13/6/2016 22:25:50
 +
line 1
 +
 +
== Limitations ==
 +
 +
The amount of data is limited to somewhat between 4kb and 8kb of raw string data. If output data buffer is too big then 'console.log' call will be silently discarded.
  
 
{{NavMenu}}
 
{{NavMenu}}

Latest revision as of 15:50, 18 October 2022

Logs data to the runtime log. Read more about runtime logs.

console.log(...arguments);

Reference

This command accepts the following parameters:

Variable Required Description


Input:
...arguments yes any number of arguments to be logged to the log. Objects can be translated to a string using JSON.stringify()
Output:
result This function does not return anything

Important notice

Since logs are being saved in asynchronous way, consecutive console.log() may shuffle:

console.log("line 1");
console.log("line 2");

may generate the following under a heavy load:

13/6/2016 22:25:50
line 2
13/6/2016 22:25:50
line 1

Limitations

The amount of data is limited to somewhat between 4kb and 8kb of raw string data. If output data buffer is too big then 'console.log' call will be silently discarded.