| UnifiedLogger | R Documentation |
Unified Logger for mLLMCelltype Package
Unified Logger for mLLMCelltype Package
This logger provides centralized, multi-level logging with structured output, log rotation, and performance monitoring capabilities.
log_dirDirectory for storing log files
log_levelCurrent logging level
session_idUnique identifier for the current session
max_log_sizeMaximum log file size in MB (default: 10MB)
max_log_filesMaximum number of log files to keep (default: 5)
enable_consoleWhether to output to console (default: FALSE)
enable_jsonWhether to use JSON format (default: TRUE)
performance_statsPerformance monitoring statistics
new()Initialize the unified logger
UnifiedLogger$new( base_dir = "logs", level = "INFO", max_size = 10, max_files = 5, console_output = FALSE, json_format = TRUE )
debug()Log a debug message
UnifiedLogger$debug(message, context = NULL)
info()Log an info message
UnifiedLogger$info(message, context = NULL)
warn()Log a warning message
UnifiedLogger$warn(message, context = NULL)
error()Log an error message
UnifiedLogger$error(message, context = NULL)
log_api_call()Log API call performance
UnifiedLogger$log_api_call( provider, model, duration, success = TRUE, tokens = NULL )
log_api_request_response()Log complete API request and response for debugging and audit
UnifiedLogger$log_api_request_response( provider, model, prompt_content, response_content, request_metadata = NULL, response_metadata = NULL )
log_cache_operation()Log cache operations
UnifiedLogger$log_cache_operation(operation, key, size = NULL)
log_cluster_progress()Log cluster annotation progress
UnifiedLogger$log_cluster_progress(cluster_id, stage, progress = NULL)
log_discussion()Log detailed cluster discussion with complete model conversations
UnifiedLogger$log_discussion(cluster_id, event_type, data = NULL)
log_model_response()Log model response with concise summary in main log and full text in file
UnifiedLogger$log_model_response( provider, model, response, stage = "annotation", cluster_id = NULL )
get_performance_summary()Get performance summary
UnifiedLogger$get_performance_summary()
cleanup_logs()Clean up old log files
UnifiedLogger$cleanup_logs(force = FALSE)
set_level()Set logging level
UnifiedLogger$set_level(level)
clone()The objects of this class are cloneable with this method.
UnifiedLogger$clone(deep = FALSE)
deepWhether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.