mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-04 07:06:36 +08:00
Refactor logging to use slog package across the application
- Replaced standard log package with log/slog in httpclient, nginx manager, sync service, updater, and other components for structured logging. - Introduced environment variable `LOG_LEVEL` to control logging levels (debug, info, warn, error). - Updated documentation to reflect changes in logging configuration and requirements. - Added a new logging setup function in the ats_agent internal package to initialize the slog logger.
This commit is contained in:
@@ -3,7 +3,6 @@ package common
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -59,12 +58,12 @@ func init() {
|
||||
var err error
|
||||
*LogDir, err = filepath.Abs(*LogDir)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
FatalLog(err)
|
||||
}
|
||||
if _, err := os.Stat(*LogDir); os.IsNotExist(err) {
|
||||
err = os.Mkdir(*LogDir, 0777)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
FatalLog(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user