Skip to content

API Reference

Comprehensive API documentation for AuroraCore components.

📚 Available APIs

Core Components

  • Logger API - High-performance logging system

    • Synchronous and asynchronous logging
    • Multiple output formats and destinations
    • Log rotation and compression
    • Daemon mode for system-wide logging
  • FileWatcher API - Real-time file system monitoring

    • inotify-based file watching
    • Recursive directory monitoring
    • Event filtering and batching
    • High-performance event processing
  • CLI Tools - Command-line utilities

    • Logger daemon management
    • File monitoring tools
    • Configuration utilities
    • Performance testing tools

🚀 Quick Start

Basic Logger Usage

cpp
#include "AuroraCore/logger_api.hpp"

// Initialize logger
LoggerConfig config;
config.log_dir = "/sdcard/logs";
config.max_file_size = 10 * 1024 * 1024;  // 10MB

Logger logger(config);

// Log messages
logger.info("Application started");
logger.error("Error occurred: {}", error_message);

Basic FileWatcher Usage

cpp
#include "AuroraCore/filewatcher_api.hpp"

// Setup file watcher
FileWatcherConfig config;
config.recursive = true;
config.events = FileEvent::CREATED | FileEvent::MODIFIED;

FileWatcher watcher("/path/to/watch", config);

// Set callback
watcher.set_callback([](const FileEvent& event) {
    std::cout << "File " << event.path << " was " << event.type << std::endl;
});

watcher.start();

📖 API Categories

Logging APIs

ComponentDescriptionUse Case
LoggerCore logging functionalityApplication logging
LoggerDaemonSystem-wide logging serviceCentralized logging
LoggerClientClient for daemon communicationMulti-process logging

File Monitoring APIs

ComponentDescriptionUse Case
FileWatcherFile system event monitoringReal-time file tracking
WatcherCoreLow-level inotify wrapperCustom monitoring solutions

Utility APIs

ComponentDescriptionUse Case
BufferManagerMemory buffer managementHigh-performance I/O
FileManagerFile operations and rotationLog file management
IPCClientInter-process communicationDaemon communication

🔧 Configuration

Logger Configuration

cpp
struct LoggerConfig {
    std::string log_dir = "/tmp/logs";
    size_t max_file_size = 10 * 1024 * 1024;
    int max_files = 5;
    LogLevel min_level = LogLevel::INFO;
    bool async_mode = true;
    size_t buffer_size = 1024 * 1024;
    int flush_interval = 5000;
};

FileWatcher Configuration

cpp
struct FileWatcherConfig {
    bool recursive = false;
    int max_depth = -1;
    FileEventMask events = FileEvent::ALL;
    std::vector<std::string> exclude_patterns;
    std::function<bool(const std::string&)> file_filter;
};

📊 Performance Considerations

Logger Performance

  • Buffer Size: Larger buffers reduce I/O frequency
  • Async Mode: Non-blocking logging for better performance
  • Compression: Reduces disk usage but increases CPU load
  • Daemon Mode: Centralizes logging overhead

FileWatcher Performance

  • Event Filtering: Reduce unnecessary events
  • Batch Processing: Handle multiple events together
  • Recursive Limits: Avoid deep directory structures
  • inotify Limits: System-level watch limits

📞 Support

For API-specific questions:

  • Check the detailed API documentation for each component
  • Review the FAQ for common issues
  • Browse examples for usage patterns
  • Submit issues on GitHub

Released under the MIT License.