99
1010 "github.com/alecthomas/kong"
1111 "github.com/brianm/kongcue"
12- "github.com/epithet-ssh/epithet/pkg/slogoslog"
1312 "github.com/epithet-ssh/epithet/pkg/tlsconfig"
1413 "github.com/lmittmann/tint"
1514)
@@ -21,11 +20,10 @@ var (
2120)
2221
2322var cli struct {
24- Version kong.VersionFlag `short:"V" help:"Print version information"`
25- Verbose int `short:"v" type:"counter" help:"Increase verbosity (-v for debug, -vv for trace)"`
26- LogFile string `name:"log-file" help:"Path to log file (supports ~ expansion)" env:"EPITHET_LOG_FILE"`
27- NativeLog bool `name:"native-log" help:"Use native OS logging (macOS: Console.app)" env:"EPITHET_NATIVE_LOG"`
28- Config kongcue.Config `help:"Path to config file" sep:";" default:"/etc/epithet/*.{cue,yaml,yml,json};~/.epithet/*.{cue,yaml,yml,json}"`
23+ Version kong.VersionFlag `short:"V" help:"Print version information"`
24+ Verbose int `short:"v" type:"counter" help:"Increase verbosity (-v for debug, -vv for trace)"`
25+ LogFile string `name:"log-file" help:"Path to log file (supports ~ expansion)" env:"EPITHET_LOG_FILE"`
26+ Config kongcue.Config `help:"Path to config file" sep:";" default:"/etc/epithet/*.{cue,yaml,yml,json};~/.epithet/*.{cue,yaml,yml,json}"`
2927
3028 // TLS configuration flags (global)
3129 Insecure bool `help:"Disable TLS certificate verification (NOT RECOMMENDED)" env:"EPITHET_INSECURE"`
@@ -84,7 +82,7 @@ func expandPath(path string) (string, error) {
8482}
8583
8684func setupLogger () * slog.Logger {
87- // Determine log level based on verbosity.
85+ // Determine log level based on verbosity
8886 level := slog .LevelWarn
8987 switch cli .Verbose {
9088 case 0 :
@@ -95,24 +93,15 @@ func setupLogger() *slog.Logger {
9593 level = slog .LevelDebug
9694 }
9795
98- // If native logging requested, try to use it.
99- if cli .NativeLog {
100- if handler := slogoslog .NewHandler (level ); handler != nil {
101- return slog .New (handler )
102- }
103- // Fall through to default handler if native not available.
104- slog .Warn ("native logging not available on this platform, using console" )
105- }
106-
107- // Determine output writer.
96+ // Determine output writer
10897 var w io.Writer = os .Stderr
10998 if cli .LogFile != "" {
11099 path , err := expandPath (cli .LogFile )
111100 if err != nil {
112- // Fall back to stderr if path expansion fails.
101+ // Fall back to stderr if path expansion fails
113102 slog .Error ("failed to expand log file path" , "error" , err )
114103 } else {
115- // Ensure parent directory exists.
104+ // Ensure parent directory exists
116105 if err := os .MkdirAll (filepath .Dir (path ), 0700 ); err != nil {
117106 slog .Error ("failed to create log directory" , "error" , err )
118107 } else {
0 commit comments