feat: externalize filter configuration and add global structured logging and job reprocessing functionality
This commit is contained in:
+18
-10
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -10,6 +9,7 @@ import (
|
||||
"github.com/hireme/hireme/internal/analyzer"
|
||||
"github.com/hireme/hireme/internal/config"
|
||||
"github.com/hireme/hireme/internal/db"
|
||||
"github.com/hireme/hireme/internal/logger"
|
||||
"github.com/hireme/hireme/internal/ui"
|
||||
"github.com/hireme/hireme/internal/worker"
|
||||
"github.com/spf13/cobra"
|
||||
@@ -25,11 +25,13 @@ func newRootCmd() *cobra.Command {
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
cfg.Normalize()
|
||||
|
||||
log.Println("==========================================================")
|
||||
log.Println("🚀 Starting Hireme (GJCC) Job Application Command Center")
|
||||
log.Println("==========================================================")
|
||||
log.Printf("[Config] Port: %s | DB Path: %s | Target Config: %s | Active LLM: %s",
|
||||
cfg.Port, cfg.DBPath, cfg.TargetConfig, cfg.LLMProvider)
|
||||
logger.SetLevel(cfg.LogLevel)
|
||||
|
||||
logger.Log.Info("==========================================================")
|
||||
logger.Log.Info("🚀 Starting Hireme (GJCC) Job Application Command Center")
|
||||
logger.Log.Info("==========================================================")
|
||||
logger.Log.Infof("[Config] Port: %s | DB Path: %s | Target Config: %s | Active LLM: %s | Log Level: %s",
|
||||
cfg.Port, cfg.DBPath, cfg.TargetConfig, cfg.LLMProvider, cfg.LogLevel)
|
||||
|
||||
// Ensure DB directory exists
|
||||
dbDir := filepath.Dir(cfg.DBPath)
|
||||
@@ -46,7 +48,7 @@ func newRootCmd() *cobra.Command {
|
||||
|
||||
// Load targets from YAML config if database is empty
|
||||
if err := database.LoadTargetsFromYAML(cfg.TargetConfig); err != nil {
|
||||
log.Printf("[Main] Target YAML loading status: %v", err)
|
||||
logger.Log.Errorf("[Main] Target YAML loading status: %v", err)
|
||||
}
|
||||
|
||||
// Initialize LLM Analyzer
|
||||
@@ -55,8 +57,14 @@ func newRootCmd() *cobra.Command {
|
||||
return fmt.Errorf("fatal Analyzer setup error: %w", err)
|
||||
}
|
||||
|
||||
// Initialize Worker Pool
|
||||
pool := worker.NewWorkerPool(database, llmAnalyzer, 3)
|
||||
// Load filter configuration
|
||||
filterCfg, err := config.LoadFilterConfig(cfg.FilterConfig)
|
||||
if err != nil {
|
||||
logger.Log.Fatalf("Failed to load filter config: %v", err)
|
||||
}
|
||||
|
||||
// 4. Initialize Worker Pool
|
||||
pool := worker.NewWorkerPool(database, llmAnalyzer, 3, filterCfg)
|
||||
pool.Start() // Auto start the worker pool
|
||||
|
||||
// Setup UI Server & Routes
|
||||
@@ -65,7 +73,7 @@ func newRootCmd() *cobra.Command {
|
||||
server.RegisterRoutes(mux)
|
||||
|
||||
addr := fmt.Sprintf(":%s", cfg.Port)
|
||||
log.Printf("✨ Hireme Command Center is live at http://localhost:%s", cfg.Port)
|
||||
logger.Log.Infof("✨ Hireme Command Center is live at http://localhost:%s", cfg.Port)
|
||||
return http.ListenAndServe(addr, mux)
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user