HomeWiki
HomeWiki
  1. Log
  • Back to home
  • 2. Connectivity
  • Introduction
  • Custom Script
  • Playground
  • Database Explorer
  • Log Stream
  • Direct Communication
  • Softone
    • Getting Started
  • Datapump
    • Getting Started
    • Crons
    • Legacy Windows Support
    • SDK
      • DB
        • _executeQuery
        • _executeStoreProcedure
        • _executeInsertQuery
        • _executeInsertQueriesInTransaction
      • Import
        • _productsImport
        • _categoriesImport
        • _brandsImport
        • _attributesImport
        • _attributeSetsImport
        • _unitsImport
        • _quantityImport
        • _customersImport
        • _contactsImport
        • _callsImport
        • _eventsImport
        • _tasksImport
        • _ordersImport
        • _usersImport
        • _customerSourceTagsImport
        • _productSourceTagsImport
      • Log
        • _logDebug
        • _logInfo
        • _logWarn
        • _logError
      • Web Requests
        • _httpGetJson
        • _httpPostJson
        • _httpPutJson
        • _httpDeleteJson
        • _httpPatchJson
      • Variables
        • _saveVariable
        • _getVariable
        • _deleteVariable
      • Blob
        • _blobConnect
        • _blobExists
        • _blobGet
        • _blobFind
      • Utils
        • _encodeBase64
        • _sleep
        • _getLastSyncDate
        • _updateLastSyncDate
        • _resetLastSyncDate
  1. Log

_logError

Documentation: _logError Function#

The _logError function is used to log error messages within the system. This function captures and records critical errors or exceptions that occur during the execution of the application. By logging errors, developers and system administrators can track and diagnose issues that require immediate attention or troubleshooting. The function also allows for the optional categorization of errors using tags for better organization.

Function Signature:#

Parameters:#

log (Required):
Description: The error message or exception that needs to be logged. This should describe the nature of the error and, if applicable, provide context on where and why it occurred.
Type: String
Example:
tag (Optional):
Description: A tag that categorizes the error log. Tags help in organizing and filtering error logs, making it easier to track issues related to specific components or processes. If not provided, the log will be categorized under a default tag like "General".
Type: String
Example:

Return Value:#

Returns:
The function does not return any value. It performs the logging operation by storing or displaying the error message along with the associated tag.

Function Workflow:#

1.
Validate Log Message:
The function checks if the log parameter is provided and is a valid string. If the log is missing or invalid, the logging operation might be skipped, or an error might be raised.
2.
Assign Tag:
If the tag parameter is provided, the error log is associated with that tag. If the tag is not provided, the function assigns a default tag, such as "General" or "Error".
3.
Log the Error:
The function logs the error message along with the tag (if any). This could involve writing the log to a file, sending it to a logging server, or displaying it in a console.
4.
Optional Error Handling:
The function may include error handling to ensure that any issues during the logging process do not disrupt the normal operation of the application.

Example Usage:#

Important Considerations:#

Use Clear Error Messages:
Ensure that the log parameter contains a clear and descriptive error message. This helps in quickly identifying the issue and understanding its context.
Categorize Errors with Tags:
Use the tag parameter to categorize errors, making it easier to filter and prioritize issues for resolution. Tags can help in organizing errors by components, modules, or severity.
By utilizing _logError, developers can effectively track and manage critical issues within the system, ensuring that errors are documented and can be addressed promptly to maintain the stability and reliability of the application.
Previous
_logWarn
Next
_httpGetJson
Built with