Skip to content

api trace

Ayhan Rashidov edited this page Sep 5, 2022 · 2 revisions

$.trace API

Represents the trace namespace with its methods.

Reference

Provides tracing functions that enable your application to write predefined messages in the form of application-specific trace output.

SAP Help

https://help.sap.com/doc/3de842783af24336b6305a3c0223a369/2.0.03/en-US/$.trace.html

Module

https://github.com/codbex/codbex-kronos/tree/main/modules/api/api-xsjs/src/main/resources/META-INF/dirigible/kronos/trace

Sample Usage

let trace = $.trace;
let response = require('http/v4/response');

// Check trace methods availability in the "Preview" tab
response.println("Debug logging enabled: " +trace.isDebugEnabled());
response.println("Error logging enabled: " +trace.isErrorEnabled());
response.println("Fatal logging enabled: " +trace.isFatalEnabled());
response.println("Info logging enabled: " +trace.isInfoEnabled());
response.println("Warning logging enabled: " +trace.isWarningEnabled());

// If the trace method is enabled, it will print the message in the "Console" tab
trace.debug("Debug message!");
trace.error("Error message!");
trace.error("Fatal message!");
trace.info("Info message!");
trace.warning("Warning message!");

Environment Variables

Name Description Default value
KRONOS_LOG_DEBUG_ENABLED Enables debug level logging. true
KRONOS_LOG_ERROR_ENABLED Enables error level logging. true
KRONOS_LOG_FATAL_ENABLED Enables fatal level logging. true
KRONOS_LOG_INFO_ENABLED Enables log level logging. true
KRONOS_LOG_WARNING_ENABLED Enables warning level logging. true

Coverage

Methods Description Status
debug(message) Writes the given message with the trace-level debug to the application trace file.
error(message) Writes the given message with the trace-level error to the application trace file.
fatal(message) Writes the given message with the trace-level fatal to the application trace file.
info(message) Writes the given message with the trace-level info to the application trace file.
warning(message) Writes the given message with the trace-level warning to the application trace file.
isDebugEnabled() Returns true or false to show whether or not the tracer writes an entry in the application trace file for the trace-level debug.
isErrorEnabled() Returns true or false to show whether or not the tracer writes an entry in the application trace file for the trace-level error.
isFatalEnabled() Returns true or false to show whether or not the tracer writes an entry in the application trace file for the trace-level fatal.
isInfoEnabled() Returns true or false to show whether or not the tracer writes an entry in the application trace file for the trace-level info.
isWarningEnabled() Returns true or false to show whether or not the tracer writes an entry in the application trace file for the trace-level warning.

Unit Tests ⚠️

https://github.com/codbex/codbex-kronos/tree/main/modules/engines/engine-xsjs/src/test/resources/META-INF/dirigible/test/kronos/trace

Integration Tests ❌

Wiki icons legend

✅ - Feature implemented and working as supposed.
⚠️ - Feature partially implemented and needs to be finished.
❌ - Feature not implemented yet.

Clone this wiki locally