function log_info
Logs an informational message using a logger named 'EmailForwarder'.
/tf/active/vicechatdev/email-forwarder/src/utils/logger.py
61 - 62
simple
Purpose
This function provides a convenient wrapper for logging informational messages through Python's logging module. It retrieves or creates a logger instance named 'EmailForwarder' and logs the provided message at the INFO level. This is useful for tracking application flow, status updates, and non-error events in an email forwarding application.
Source Code
def log_info(message: str):
logging.getLogger("EmailForwarder").info(message)
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
message |
str | - | positional_or_keyword |
Parameter Details
message: A string containing the informational message to be logged. This can be any text describing an event, status, or information that should be recorded at the INFO logging level. No specific format or constraints are enforced.
Return Value
This function does not return any value (implicitly returns None). It performs a side effect of writing a log entry to the configured logging handlers for the 'EmailForwarder' logger.
Dependencies
logging
Required Imports
import logging
Usage Example
import logging
# Configure logging (required for output to be visible)
logging.basicConfig(level=logging.INFO, format='%(name)s - %(levelname)s - %(message)s')
def log_info(message: str):
logging.getLogger("EmailForwarder").info(message)
# Use the function
log_info("Email forwarding service started")
log_info("Processing 5 new emails")
log_info("All emails forwarded successfully")
Best Practices
- Ensure logging is properly configured before calling this function, otherwise log messages may not appear
- Use this function consistently throughout the application for INFO-level messages to maintain a unified logging approach
- Consider creating similar wrapper functions for other log levels (debug, warning, error, critical) for consistency
- The logger name 'EmailForwarder' should be consistent across the application to allow for centralized logger configuration
- Avoid logging sensitive information (passwords, tokens, personal data) even at INFO level
Similar Components
AI-powered semantic similarity - components with related functionality:
-
function log_error 81.1% similar
-
function log_debug 79.2% similar
-
function log_warning 78.2% similar
-
function print_banner 49.7% similar
-
function main_v69 47.5% similar