Ask AI
Skip to main content

Write to application log

Function: Write to application log

This function allows you to record important messages and events directly into your application's internal logs. Think of it as a digital diary for your application, where you can note down what's happening behind the scenes. This is incredibly useful for tracking user actions, debugging issues, or simply monitoring the health of your application without displaying messages directly to the user.

Input

  • Text (STRING, Required) The exact message you want to write into the application log. This can be a simple sentence or a more complex message that includes dynamic information using placeholders.
  • Logline placeholders (OBJECT, Optional) If your "Text" message contains placeholders (e.g., \{\{USERNAME\}\}, \{\{ORDER_ID\}\}), you can provide an object here where each attribute's name matches a placeholder, and its value is what you want to insert. For example, if your text is "User {{USERNAME}} logged in", you would provide an object like \{ USERNAME: "JohnDoe" \}.
  • Level (SELECT_ONE, Default: INFO) This determines the severity or importance of the log message. Choosing the right level helps you filter and understand your logs more effectively.
    • ERROR: Critical issues that prevent the application from functioning correctly.
    • WARN: Potential problems or unexpected events that don't stop the application but might need attention.
    • INFO: General information about the application's progress or state. This is the default level.
    • DEBUG: Detailed information, typically used by developers to diagnose problems.
    • TRACE: Extremely detailed, often step-by-step information, usually for deep debugging.

Output

This function does not produce a direct output that can be used in subsequent steps. Its primary purpose is to record information in your application's internal logs for monitoring and troubleshooting.

Execution Flow

Real-Life Examples

Example 1: Logging a successful user action

Imagine you want to record every time a user successfully updates their profile.

  • Inputs:
    • Text: "User {{USERNAME}} successfully updated their profile."
    • Logline placeholders: \{ USERNAME: "AliceSmith" \}
    • Level: INFO
  • Result: A message "User AliceSmith successfully updated their profile." is recorded in the application's internal logs at the INFO level.

Example 2: Debugging a data processing step

Suppose you have a complex process that imports data, and you want to log detailed information about each record being processed to help debug potential issues.

  • Inputs:
    • Text: "Processing record ID: {{RECORD_ID}} with status: {{STATUS}}."
    • Logline placeholders: \{ RECORD_ID: "12345", STATUS: "Pending" \}
    • Level: DEBUG
  • Result: A message "Processing record ID: 12345 with status: Pending." is recorded in the application's internal logs at the DEBUG level.

Example 3: Reporting a critical error

If a crucial integration with an external service fails, you'd want to log this as an error to ensure it's addressed quickly.

  • Inputs:
    • Text: "Failed to connect to payment gateway for order {{ORDER_NUMBER}}. Please investigate."
    • Logline placeholders: \{ ORDER_NUMBER: "ORD7890" \}
    • Level: ERROR
  • Result: A message "Failed to connect to payment gateway for order ORD7890. Please investigate." is recorded in the application's internal logs at the ERROR level, signaling a critical issue.