FlowPDF::Log

2 minute readReferenceExtensibilityDeveloper productivity

This class provides methods to support the logging functionality of FlowPDF. This class gets loaded by FlowPDF, before other components get initialized.

A few points to note about logging.
  • The log level which is retrieved from the debugLevel property in the configuration, control which messages get written to the logs.

  • + The Methods provided by this class facilitate the classification of a

    message into any one of the following.
    • Log

    • Debug

    • Trace

    • Warning

    • Error

  • The log level and the classification of messages work together to surface the severity of a message.

  • Regardless of the log level Warning and Error Messages will always be written.

  • Logged messages are appropriately prefaced by [DEBUG], [TRACE], [WARNING], [ERROR] based on their classification.

It supports the following log levels:

  • INFO

    This is the default level.

    debugLevel property should be set to 0.

  • DEBUG

    Provides the same output from INFO level + debug output.

    debugLevel property should be set to 1.

  • TRACE

    Provides the same output from DEBUG level + TRACE output.

    debugLevel property should be set to 2.

To import FlowPDF::Log do the following.

use FlowPDF::Log

All the following methods get loaded in current scope upon import.

logInfo(@messages)

Logs an info message. Output is the same as from print function.

Parameters

(List of String) Log messages

Returns

(Boolean) 1

Usage

logInfo("This is an info message");

logDebug(@messages)

Logs a debug message.

Parameters

(List of String) Log messages

Returns

(Boolean) 1

Usage

# This message will be written only if log level is DEBUG or higher. logDebug("This is a debug message");

logTrace(@messages)

Logs a trace message

Parameters

(List of String) Log messages

Returns

(Boolean) 1

Usage

# This message will be written only if log level is TRACE (the highest level). logTrace("This is a debug message");

logWarning(@messages)

Logs a warning message.

Parameters

(List of String) Log messages

Returns

(Boolean) 1

Usage

# This message will be written always (irrespective of the log level). logWarning("This is a warning message");

logError(@messages)

Logs an error message

Parameters

(List of String) Log messages

Returns

(Boolean) 1

Usage

# This message will be written always (irrespective of the log level). logError("This is an error message");

logInfoDiag(@messages)

This function works exactly as logInfo, but adds additional markups into log. Then this info will be displayed at Diagnostic tab of a job.

logWarningDiag(@messages)

This function works exactly as logWarning, but adds additional markups into log. Then this warning will be displayed at Diagnostic tab of a job.

logErrorDiag(@messages)

This function works exactly as logError, but adds additional markups into log. Then this error will be displayed at Diagnostic tab of a job.