SparkLog

A Logging interface that can be called from scripts.

This interface writes to the script.log table that is accessible in the developer portal using the NoSQL explorer tool.

The object passed can either be complex JSON or simple javascript values.

e.g.

var logger = Spark.getLog();

debug

signature debug(JSON msg)

returns void

Records value into the spark.log table with the level set to debug.

params

msg - the message to log

example

Spark.getLog().debug("Simple string logging");

info

signature info(JSON msg)

returns void

Records value into the spark.log table with the level set to info.

params

msg - the message to log

example

Spark.getLog().info({type:"JSON logging"});

warn

signature warn(JSON msg)

returns void

Records value into the spark.log table with the level set to warn.

params

msg - the message to log

example

Spark.getLog().warn({type:"JSON logging"})

error

signature error(JSON msg)

returns void

Records value into the spark.log table with the level set to info.

params

msg - the message to log

example

Spark.getLog().error({type:"JSON logging"})

getLevel

signature getLevel()

returns string

Returns the currently configured log level.

example

Spark.getLog().getLevel()

setLevel

signature setLevel(string level)

returns void

Updates the current level that logs will be written at.

Entries will only be written if the level is greater than the current level set.

Available levels are: "DEBUG", "INFO", "WARN", "ERROR".

Note: this change takes time to propagate throughout the system, it may be minutes before all servers are using the new level.

params

level - the new level at which to log

example

Spark.getLog().setLevel("DEBUG")
Did this page help you? Please enter your feedback below. For questions about using this part of the platform, please contact support here