Ask AI
Skip to main content

Write to application log

Function: Write to application log

This function allows you to record important messages or information directly into your application's log. This is useful for tracking the flow of your application, debugging issues, or simply noting when certain events occur. You can customize the message and its severity level to help you quickly identify and understand events within your application.

Input

  • Text (Required): This is the actual message you want to write to the log. It's a piece of text.
  • Logline placeholders: This is an optional collection of key-value pairs. If your "Text" contains special markers like \{\{PLACEHOLDER_NAME\}\}, you can define values here to automatically replace those markers in your log message. For example, if your text is "User {{USERNAME}} logged in", you can provide a placeholder named USERNAME with the value "Alice" to get "User Alice logged in" in your log.
  • Level: This determines the severity of your log message. It's a choice from a predefined list. The default level is "Info".
    • Options:
      • Error: For critical issues that prevent the application from functioning correctly.
      • Debug: Detailed information useful for developers during troubleshooting.
      • Warn: Potential issues that don't stop the application but might need attention.
      • Info: General information about the application's progress.
      • Trace: Extremely detailed information, often used for tracing execution paths.

Output

This function does not produce any direct output that can be used in subsequent steps of your application. Its effect is to write a message to the application's internal log.

Execution Flow

Real-Life Examples

  • Example 1: Logging a simple informational message

    • Inputs:
      • Text: "Order #12345 has been successfully processed."
      • Logline placeholders: (Leave empty)
      • Level: "Info"
    • Result: An informational message "Order #12345 has been successfully processed." is added to the application log, indicating a successful operation.
  • Example 2: Logging a warning with dynamic information

    • Inputs:
      • Text: "User {{USER_ID}} attempted to access restricted area from IP {{IP_ADDRESS}}."
      • Logline placeholders:
      • Level: "Warn"
    • Result: A warning message "User john.doe@example.com attempted to access restricted area from IP 192.168.1.100." is added to the application log, highlighting a potential security concern that might need investigation.
  • Example 3: Logging an error for a failed operation

    • Inputs:
      • Text: "Failed to connect to payment gateway for transaction {{TRANSACTION_ID}}. Please check network settings."
      • Logline placeholders:
        • TRANSACTION_ID: "TXN-98765"
      • Level: "Error"
    • Result: An error message "Failed to connect to payment gateway for transaction TXN-98765. Please check network settings." is added to the application log, indicating a critical failure that requires immediate attention.