container->set(LogRepositoryInterface::class, function () { return new LogRepository(); }); $this->container->set(SensitiveDataRedactor::class, function () { return new SensitiveDataRedactor(); }); $this->container->set(Logger::class, function ($c) { return new Logger( $c->get(LogRepositoryInterface::class), $c->get(SensitiveDataRedactor::class) ); }); } /** * @inheritDoc */ public function boot(): void { // Hook for clearing expired logs. add_action('oneclickformsync_cleanup_logs', function () { $this->container->get(Logger::class)->runCleanUp(); }); // Ensure cleanup cron is scheduled. if (!wp_next_scheduled('oneclickformsync_cleanup_logs')) { wp_schedule_event(time(), 'daily', 'oneclickformsync_cleanup_logs'); } } }