@@ -2,11 +2,11 @@ package commands
22
33import (
44 "fmt"
5+ "log/slog"
56 "os"
67
78 "github.com/malamtime/cli/model"
89 "github.com/pterm/pterm"
9- "github.com/sirupsen/logrus"
1010 "github.com/urfave/cli/v2"
1111 "go.opentelemetry.io/otel/attribute"
1212 "go.opentelemetry.io/otel/trace"
@@ -37,7 +37,7 @@ func printPullResults(result map[model.DotfileAppName][]dotfilePullFileResult, d
3737
3838 // No files to process
3939 if totalProcessed == 0 && totalFailed == 0 && totalSkipped == 0 {
40- logrus . Infoln ("No dotfiles found to process" )
40+ slog . Info ("No dotfiles found to process" )
4141 pterm .Info .Println ("No dotfiles to process" )
4242 return
4343 }
@@ -117,7 +117,7 @@ func printPullResults(result map[model.DotfileAppName][]dotfilePullFileResult, d
117117 }
118118
119119 // Log for debugging
120- logrus . Infof ("Pull complete - Processed: %d, Skipped: %d, Failed: %d" , totalProcessed , totalSkipped , totalFailed )
120+ slog . Info ("Pull complete" , slog . Int ( "processed" , totalProcessed ), slog . Int ( "skipped" , totalSkipped ), slog . Int ( "failed" , totalFailed ) )
121121}
122122
123123func pullDotfiles (c * cli.Context ) error {
@@ -131,7 +131,7 @@ func pullDotfiles(c *cli.Context) error {
131131
132132 config , err := configService .ReadConfigFile (ctx )
133133 if err != nil {
134- logrus . Errorln ( err )
134+ slog . Error ( "failed to read config file" , slog . Any ( " err" , err ) )
135135 return err
136136 }
137137
@@ -169,15 +169,15 @@ func pullDotfiles(c *cli.Context) error {
169169 }
170170
171171 // Fetch dotfiles from server
172- logrus . Infof ("Fetching dotfiles from server..." )
172+ slog . Info ("Fetching dotfiles from server..." )
173173 resp , err := model .FetchDotfilesFromServer (ctx , mainEndpoint , filter )
174174 if err != nil {
175- logrus . Errorln ("Failed to fetch dotfiles from server: " , err )
175+ slog . Error ("Failed to fetch dotfiles from server" , slog . Any ( " err" , err ) )
176176 return err
177177 }
178178
179179 if resp == nil || len (resp .Data .FetchUser .Dotfiles .Apps ) == 0 {
180- logrus . Infoln ("No dotfiles found on server" )
180+ slog . Info ("No dotfiles found on server" )
181181 fmt .Println ("\n 📭 No dotfiles found on server" )
182182 return nil
183183 }
@@ -188,18 +188,18 @@ func pullDotfiles(c *cli.Context) error {
188188 appName := model .DotfileAppName (appData .App )
189189 app , exists := appHandlers [appName ]
190190 if ! exists {
191- logrus . Warnf ("Unknown app type: %s" , appData .App )
191+ slog . Warn ("Unknown app type" , slog . String ( "app" , appData .App ) )
192192 continue
193193 }
194194
195- logrus . Infof ("Processing %s dotfiles..." , appData .App )
195+ slog . Info ("Processing dotfiles..." , slog . String ( "app" , appData .App ) )
196196
197197 // Collect files to process for this app
198198 filesToProcess := make (map [string ]string )
199199
200200 for _ , file := range appData .Files {
201201 if len (file .Records ) == 0 {
202- logrus . Debugf ("No records found for %s" , file .Path )
202+ slog . Debug ("No records found" , slog . String ( "path" , file .Path ) )
203203 continue
204204 }
205205
@@ -246,7 +246,7 @@ func pullDotfiles(c *cli.Context) error {
246246 // Check which files are different
247247 equalityMap , err := app .IsEqual (ctx , filesToProcess )
248248 if err != nil {
249- logrus . Warnf ("Failed to check file equality for %s: %v" , appData .App , err )
249+ slog . Warn ("Failed to check file equality" , slog . String ( "app" , appData .App ), slog . Any ( " err" , err ) )
250250 }
251251
252252 // Filter out files that are already equal
@@ -255,7 +255,7 @@ func pullDotfiles(c *cli.Context) error {
255255
256256 for path , content := range filesToProcess {
257257 if isEqual , exists := equalityMap [path ]; exists && isEqual {
258- logrus . Debugf ("Skipping %s - content is identical" , path )
258+ slog . Debug ("Skipping - content is identical" , slog . String ( " path" , path ) )
259259 result [appName ] = append (result [appName ], dotfilePullFileResult {
260260 path : path ,
261261 isSkipped : true ,
@@ -267,20 +267,20 @@ func pullDotfiles(c *cli.Context) error {
267267 }
268268
269269 if len (filesToUpdate ) == 0 {
270- logrus . Infof ("All %s files are up to date" , appData .App )
270+ slog . Info ("All files are up to date" , slog . String ( "app" , appData .App ) )
271271 continue
272272 }
273273
274274 results := make ([]dotfilePullFileResult , 0 )
275275
276276 // Backup files that will be modified (handles dry-run internally)
277277 if err := app .Backup (ctx , pathsToActuallyBackup , dryRun ); err != nil {
278- logrus . Warnf ("Failed to backup files for %s: %v" , appData .App , err )
278+ slog . Warn ("Failed to backup files" , slog . String ( "app" , appData .App ), slog . Any ( " err" , err ) )
279279 }
280280
281281 // Save the updated files (handles dry-run internally)
282282 if err := app .Save (ctx , filesToUpdate , dryRun ); err != nil {
283- logrus . Errorf ("Failed to save files for %s: %v" , appData .App , err )
283+ slog . Error ("Failed to save files" , slog . String ( "app" , appData .App ), slog . Any ( " err" , err ) )
284284 for f := range filesToUpdate {
285285 results = append (results , dotfilePullFileResult {
286286 path : f ,
0 commit comments