File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,9 @@ package main
33import (
44 "github.com/DanielFillol/DataJUD_API_CALLER/csv"
55 "github.com/DanielFillol/DataJUD_API_CALLER/request"
6+ "io"
67 "log"
8+ "os"
79 "time"
810)
911
@@ -26,6 +28,18 @@ func main() {
2628 log .Fatal ("Error loading requests from CSV: " , err )
2729 }
2830
31+ // Setup Log file
32+ logFile , err := os .Create ("output.log.txt" )
33+ if err != nil {
34+ log .Fatal ("Failed to open log file:" , err )
35+ }
36+ defer logFile .Close ()
37+
38+ // Create a multi-writer that writes to both the file and os.Stdout (terminal)
39+ multiWriter := io .MultiWriter (os .Stdout , logFile )
40+
41+ log .SetOutput (multiWriter )
42+
2943 // Make API requests asynchronously
3044 start := time .Now ()
3145 log .Println ("Starting API calls..." )
You can’t perform that action at this time.
0 commit comments