Skip to content

Latest commit

 

History

History
56 lines (39 loc) · 1.83 KB

File metadata and controls

56 lines (39 loc) · 1.83 KB

Logging

This document outlines the logging strategy for both backend and frontend applications, utilizing Datadog for log management and monitoring.

To view the logs, navigate to the Datadog Logs Explorer.

Backend Logging (Python)

Import the unified wrapper and log at the desired level:

from modules.logger.logger import Logger

# Example usage
item_id = 123
payload = {"key": "value"}

Logger.info(message="Started background job")
Logger.debug(message=f"Payload received: {payload}")
Logger.error(message=f"Failed to process item {item_id}")

Frontend Logging (JavaScript)

Tool Purpose Docs
Datadog Logger Captures console & custom logs. JS log collection ↗
Datadog RUM Real-user monitoring & custom events. Browser RUM ↗

Usage Notes

  • Both console.* and any custom logger integrations are forwarded to Datadog when logging is enabled.
  • RUM auto-collects page views, errors, and performance metrics. Emit custom events for business-specific insights.

Usage Example

import React, { useEffect } from 'react';
import { Logger } from './utils/logger';

Logger.init();

export default function App(): React.ReactElement {
  Logger.info("This is a logger info message");
  console.log("This is a console log"); // can also be captured by Datadog

  return (
    <div>
      <h1>Sample App</h1>
      {/* Your components go here */}
    </div>
  );
}