Skip to content

Commit 81a320e

Browse files
committed
refactor(logs): uniform Info and Infof removing \n from Info
1 parent 7c701d1 commit 81a320e

12 files changed

Lines changed: 23 additions & 21 deletions

File tree

internal/command/admin/deploy/docker/docker_up.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type Up struct {
3838
}
3939

4040
func (u *Up) Run(ctx context.Context, dk deploy.DockerShell, logger log.FLogger) error {
41-
logger.Info("Deploying FunLess locally...\n")
41+
logger.Info("Deploying FunLess locally...\n\n")
4242

4343
_ = logger.StartSpinner("Setting things up...")
4444

@@ -62,7 +62,7 @@ func (u *Up) Run(ctx context.Context, dk deploy.DockerShell, logger log.FLogger)
6262
return err
6363
}
6464

65-
logger.Info("\nDeployment complete!")
65+
logger.Info("\nDeployment complete!\n")
6666
logger.Info("You can now start using FunLess! 🎉")
6767

6868
return nil

internal/command/admin/deploy/kubernetes/kubernetes_down.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ type Down struct {
2626
}
2727

2828
func (k *Down) Run(ctx context.Context, remover deploy.KubernetesRemover, logger log.FLogger) error {
29-
logger.Info("Removing Kubernetes FunLess deployment...\n")
29+
logger.Info("Removing Kubernetes FunLess deployment...\n\n")
3030

3131
_ = logger.StartSpinner("Setting things up...")
3232
if err := logger.StopSpinner(remover.WithConfig(k.KubeConfig)); err != nil {
@@ -38,7 +38,7 @@ func (k *Down) Run(ctx context.Context, remover deploy.KubernetesRemover, logger
3838
return err
3939
}
4040

41-
logger.Info("\nAll clear!")
41+
logger.Info("\nAll clear!\n")
4242

4343
return nil
4444
}

internal/command/admin/deploy/kubernetes/kubernetes_up.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type Up struct {
2727
}
2828

2929
func (k *Up) Run(ctx context.Context, deployer deploy.KubernetesDeployer, logger log.FLogger) error {
30-
logger.Info("Deploying FunLess on Kubernetes...\n")
30+
logger.Info("Deploying FunLess on Kubernetes...\n\n")
3131

3232
_ = logger.StartSpinner("Setting things up...")
3333
if err := logger.StopSpinner(deployer.WithConfig(k.KubeConfig)); err != nil {
@@ -84,8 +84,8 @@ func (k *Up) Run(ctx context.Context, deployer deploy.KubernetesDeployer, logger
8484
return err
8585
}
8686

87-
logger.Info("\nDeployment complete!")
88-
logger.Info("You can now start using FunLess! 🎉")
87+
logger.Info("\nDeployment complete!\n")
88+
logger.Info("You can now start using FunLess! 🎉\n")
8989

9090
return nil
9191
}

internal/command/fn/build.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type Build struct {
3636
}
3737

3838
func (b *Build) Run(ctx context.Context, builder build.DockerBuilder, logger log.FLogger) error {
39-
logger.Info(fmt.Sprintf("Building %s into a wasm binary...\n", b.Name))
39+
logger.Info(fmt.Sprintf("Building %s into a wasm binary...\n\n", b.Name))
4040

4141
_ = logger.StartSpinner("Setting up...")
4242
if err := logger.StopSpinner(setupBuilder(builder, b.Language, b.Destination)); err != nil {
@@ -60,7 +60,7 @@ func (b *Build) Run(ctx context.Context, builder build.DockerBuilder, logger log
6060
return err
6161
}
6262

63-
logger.Info(fmt.Sprintf("\nSuccessfully built %s.wasm 🥳🥳", b.Name))
63+
logger.Info(fmt.Sprintf("\nSuccessfully built %s.wasm 🥳🥳\n", b.Name))
6464
return nil
6565
}
6666

internal/command/fn/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ func (c *Create) Run(ctx context.Context, builder build.DockerBuilder, fnHandler
6868
}
6969
_ = logger.StopSpinner(nil)
7070

71-
logger.Info(fmt.Sprintf("\nSuccessfully created function %s/%s.", c.Namespace, c.Name))
71+
logger.Info(fmt.Sprintf("\nSuccessfully created function %s/%s.\n", c.Namespace, c.Name))
7272
return nil
7373
}

internal/command/fn/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ func (f *Delete) Run(ctx context.Context, fnHandler client.FnHandler, logger log
3232
return extractError(err)
3333
}
3434

35-
logger.Infof("\nSuccessfully deleted function %s/%s.", f.Namespace, f.Name)
35+
logger.Infof("\nSuccessfully deleted function %s/%s.\n", f.Namespace, f.Name)
3636
return nil
3737
}

internal/command/fn/delete_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func TestFnDelete(t *testing.T) {
6565
err := cmd.Run(testCtx, mockFnHandler, bufLogger)
6666

6767
require.NoError(t, err)
68-
assert.Equal(t, fmt.Sprintf("\nSuccessfully deleted function %s/%s.", testNs, testFn), (&outbuf).String())
68+
assert.Equal(t, fmt.Sprintf("\nSuccessfully deleted function %s/%s.\n", testNs, testFn), (&outbuf).String())
6969
mockFnHandler.AssertExpectations(t)
7070
})
7171

internal/command/fn/invoke_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func TestFnInvoke(t *testing.T) {
7373
err := cmd.Run(testCtx, mockFnHandler, bufLogger)
7474

7575
require.NoError(t, err)
76-
assert.Equal(t, string(testOutput)+"\n", (&outbuf).String())
76+
assert.Equal(t, string(testOutput), (&outbuf).String())
7777
mockFnHandler.AssertExpectations(t)
7878
})
7979

internal/command/fn/upload.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (u *Upload) Run(ctx context.Context, fnHandler client.FnHandler, logger log
4949
}
5050
_ = logger.StopSpinner(nil)
5151

52-
logger.Info(fmt.Sprintf("Successfully uploaded function %s/%s 👌", u.Namespace, u.Name))
52+
logger.Info(fmt.Sprintf("Successfully uploaded function %s/%s 👌\n", u.Namespace, u.Name))
5353
return nil
5454
}
5555

internal/command/mod/get.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ func (g *Get) Run(ctx context.Context, modHandler client.ModHandler, logger log.
4040
return extractError(err)
4141
}
4242
logger.Infof("Module: %s\n", *name)
43-
logger.Info("Functions:")
43+
logger.Info("Functions:\n")
4444

4545
for _, v := range functions {
46-
logger.Info(*v.Name)
46+
logger.Info(*v.Name + "\n")
4747
}
4848

4949
if g.Count {

0 commit comments

Comments
 (0)