@@ -33,18 +33,22 @@ var (
3333 }
3434)
3535
36+ func configureLogFile () {
37+ p := project .GetProject ()
38+ logger := shell .GetLogger ()
39+ logger .AddHandler (shell .NewFileLogHandler (filepath .Join (p .GetDirectory (), "var" , "log" , "kyx.log" )))
40+
41+ }
42+
3643func main () {
3744 cmds := append (commands .GetCommands (), tools .GetCommands (toolsMapping )... )
3845 cmds = append (cmds , tools .CreateCommand ("test" ))
3946 toolNames := tools .GetNames (toolsMapping )
4047
41- p := project .GetProject ()
42- logger := shell .GetLogger ()
43- logger .AddHandler (shell .NewFileLogHandler (filepath .Join (p .GetDirectory (), "var" , "log" , "kyx.log" )))
44-
4548 args := os .Args
4649
4750 if len (args ) >= 2 && slices .Contains (toolNames , args [1 ]) {
51+ configureLogFile ()
4852 cmd := tools .NewToolCommand (args [1 ], toolsMapping , args [2 :]... )
4953
5054 if err := cmd .Run (); err != nil {
@@ -56,6 +60,7 @@ func main() {
5660 }
5761
5862 if len (args ) >= 2 && args [1 ] == "test" {
63+ configureLogFile ()
5964 p := project .GetProject ()
6065 pd := p .GetDirectory ()
6166
@@ -90,10 +95,12 @@ func main() {
9095 Copyright : fmt .Sprintf ("(c) 2025-%d Jason Schilling" , time .Now ().Year ()),
9196 Commands : cmds ,
9297 Before : func (context * console.Context ) error {
98+ configureLogFile ()
9399 shell .GetConsoleLogHandler ().SetLogLevel (terminal .GetLogLevel ())
94100
95101 return nil
96102 },
103+
97104 Action : func (ctx * console.Context ) error {
98105 if ctx .Args ().Len () == 0 {
99106 return commands .WelcomeAction (ctx )
0 commit comments