GSLog - Scoped, Global

  • Versão de lançamento: Australia
  • Atualizado 12 de mar. de 2026
  • 3 min. de leitura
  • GSLog is a script include that simplifies script logging and debugging by implementing levels of log output, selectable by per-caller identified sys_properties values.

    Logs generated using the GSLog API are logged in the System Logs. Specifically, you can find System Logs in the UI by navigating to All > System Logs > System Log. You can choose to view all logs or specific log types like Application Logs, Errors, Script Log Statements, and so on under this menu item. Filtering the Source column in the All logs view can help locate your entries faster.

    Logs can be at the level of debug, info, notice, warning, err, or crit (after BSD syslog.h and followers). The default logging level is notice, so levels should be chosen accordingly.

    Use for any server-side script where you want to implement event logging.

    For more information, see Debugging scripts.

    GSLog – GSLog()

    Instantiates a GSLog object.

    Tabela 1. Parameters
    Name Type Description
    traceProperty String System property that contains a value indicating the level at or above which messages will be written to the log.
    caller String Name of the script calling the logger.
    var gl = new GSLog("com.snc.sla.tasksla.log", "TaskSLA");

    GSLog – debugOn()

    Determines if debug is turned on.

    Tabela 2. Parameters
    Name Type Description
    None
    Tabela 3. Returns
    Type Description
    Boolean

    Flag that indicates whether debug is on or off.

    Valid values:
    • true: Debug is on.
    • false: Debug is off.
    var gl = new GSLog("com.snc.sla.tasksla.log", "TaskSLA"); 
    gl.setLevel("debug");
    gs.print(gl.debugOn());

    Output:

    *** Script : true

    GSLog – getLevel(String level)

    Returns the log level.

    Tabela 4. Parameters
    Name Type Description
    level String Optional. Log level.
    Tabela 5. Returns
    Type Description
    String Log level.
    var gl = new GSLog("com.snc.sla.tasksla.log", "TaskSLA"); 
    gl.setLevel("debug");
    gs.print(gl.getLevel());

    Output:

    *** Script: debug

    GSLog – initialize(String traceProperty, String caller)

    Called by the Prototype JavaScript Framework during object creation to initialize a new instance of this class. Provide the input parameters, but do not call this method directly.

    Tabela 6. Parameters
    Name Type Description
    traceProperty String System property that contains a value indicating the level at or above which messages will be written to the log.
    caller String Name of the script calling the logger.
    Tabela 7. Returns
    Type Description
    None
    var gl = new GSLog("com.snc.sla.tasksla.log", "TaskSLA");
    

    GSLog – log(String level, String msg)

    Logs a message at the specified level.

    Tabela 8. Parameters
    Name Type Description
    level String Log level.
    msg String Message to write to the log.
    Tabela 9. Returns
    Type Description
    None
    var gl = new GSLog("com.snc.sla.tasksla.log", "TaskSLA"); 
    gl.log("debug", "debug message");

    GSLog – logAlert(String msg)

    Logs alert events.

    Tabela 10. Parameters
    Name Type Description
    msg String Message to write to the log.
    Tabela 11. Returns
    Type Description
    None
    var gl = new GSLog("com.snc.sla.tasksla.log", "TaskSLA"); 
    gl.logAlert("This is an alert");

    Output:

    *** Script [TaskSLA]: This is an alert

    GSLog – logCrit(String msg)

    Logs critical events.

    Tabela 12. Parameters
    Name Type Description
    msg String Message to write to the log.
    Tabela 13. Returns
    Type Description
    None
    var gl = new GSLog("com.snc.sla.tasksla.log", "TaskSLA"); 
    gl.logCrit("This is a critical message");

    Output:

    *** Script [TaskSLA]: This is a critical message

    GSLog – logDebug(String msg)

    Logs debug events.

    Tabela 14. Parameters
    Name Type Description
    msg String Message to write to the log.
    Tabela 15. Returns
    Type Description
    None
    var gl = new GSLog("com.snc.sla.tasksla.log", "TaskSLA"); 
    gl.logDebug("This is a debug message");

    Output:

    *** Script [TaskSLA]: This is a debug message

    GSLog – logEmerg(String msg)

    Logs emergency events.

    Tabela 16. Parameters
    Name Type Description
    msg String Message to write to the log.
    Tabela 17. Returns
    Type Description
    None
    var gl = new GSLog("com.snc.sla.tasksla.log", "TaskSLA"); 
    gl.logEmerg("This is an emergency message");

    Output:

    *** Script  [TaskSLA ] : This is an emergency message

    GSLog – logErr(String msg)

    Logs error events.

    Tabela 18. Parameters
    Name Type Description
    msg String Message to write to the log.
    Tabela 19. Returns
    Type Description
    None
    var gl = new GSLog("com.snc.sla.tasksla.log", "TaskSLA"); 
    gl.logErr("This is an error message");

    Output:

    *** Script [TaskSLA]: This is an error message

    GSLog – logInfo(String msg)

    Logs information events.

    Tabela 20. Parameters
    Name Type Description
    msg String Message to write to the log.
    Tabela 21. Returns
    Type Description
    None
    var gl = new GSLog("com.snc.sla.tasksla.log", "TaskSLA"); 
    gl.logInfo("This is an info message");

    GSLog – logNotice(String msg)

    Logs notice events.

    Tabela 22. Parameters
    Name Type Description
    msg String Message to write to the log.
    Tabela 23. Returns
    Type Description
    None
    var gl = new GSLog("com.snc.sla.tasksla.log", "TaskSLA"); 
    gl.logNotice("This is a notice");

    Output:

    *** Script [TaskSLA]: This is a notice
    

    GSLog – logWarning(String msg)

    Logs warning events.

    Tabela 24. Parameters
    Name Type Description
    msg String Message to write to the log.
    Tabela 25. Returns
    Type Description
    None
    var gl = new GSLog("com.snc.sla.tasksla.log", "TaskSLA"); 
    gl.logWarning("This is a warning message");

    Output:

    *** Script [TaskSLA]: This is a warning message

    GSLog – setLevel(String level)

    Sets the log level.

    Tabela 26. Parameters
    Name Type Description
    level String Log level to set.
    Tabela 27. Returns
    Type Description
    None
    var gl = new GSLog("com.snc.sla.tasksla.log", "TaskSLA"); 
    gl.setLevel("debug");