refactor: Decompose logger completely
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
|
||||
"github.com/pojntfx/stfs/internal/compression"
|
||||
"github.com/pojntfx/stfs/internal/keys"
|
||||
"github.com/pojntfx/stfs/internal/logging"
|
||||
"github.com/pojntfx/stfs/internal/persisters"
|
||||
"github.com/pojntfx/stfs/pkg/config"
|
||||
"github.com/pojntfx/stfs/pkg/operations"
|
||||
@@ -102,6 +103,8 @@ var archiveCmd = &cobra.Command{
|
||||
viper.GetString(fromFlag),
|
||||
viper.GetBool(overwriteFlag),
|
||||
viper.GetString(compressionLevelFlag),
|
||||
|
||||
logging.NewLogger().PrintHeader,
|
||||
)
|
||||
if err != nil {
|
||||
return nil
|
||||
@@ -145,6 +148,8 @@ var archiveCmd = &cobra.Command{
|
||||
func(hdr *tar.Header, isRegular bool) error {
|
||||
return nil // We sign above, no need to verify
|
||||
},
|
||||
|
||||
logging.NewLogger().PrintHeader,
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package cmd
|
||||
|
||||
import (
|
||||
"github.com/pojntfx/stfs/internal/keys"
|
||||
"github.com/pojntfx/stfs/internal/logging"
|
||||
"github.com/pojntfx/stfs/pkg/config"
|
||||
"github.com/pojntfx/stfs/pkg/operations"
|
||||
"github.com/spf13/cobra"
|
||||
@@ -66,6 +67,8 @@ var deleteCmd = &cobra.Command{
|
||||
|
||||
viper.GetInt(recordSizeFlag),
|
||||
viper.GetString(nameFlag),
|
||||
|
||||
logging.NewLogger().PrintHeader,
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/pojntfx/stfs/internal/logging"
|
||||
"github.com/pojntfx/stfs/pkg/inventory"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
@@ -25,6 +26,8 @@ var findCmd = &cobra.Command{
|
||||
},
|
||||
|
||||
viper.GetString(expressionFlag),
|
||||
|
||||
logging.NewLogger().PrintHeader,
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/pojntfx/stfs/internal/logging"
|
||||
"github.com/pojntfx/stfs/pkg/inventory"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
@@ -21,6 +22,8 @@ var listCmd = &cobra.Command{
|
||||
},
|
||||
|
||||
viper.GetString(nameFlag),
|
||||
|
||||
logging.NewLogger().PrintHeader,
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package cmd
|
||||
|
||||
import (
|
||||
"github.com/pojntfx/stfs/internal/keys"
|
||||
"github.com/pojntfx/stfs/internal/logging"
|
||||
"github.com/pojntfx/stfs/pkg/config"
|
||||
"github.com/pojntfx/stfs/pkg/operations"
|
||||
"github.com/spf13/cobra"
|
||||
@@ -63,6 +64,8 @@ var moveCmd = &cobra.Command{
|
||||
viper.GetInt(recordSizeFlag),
|
||||
viper.GetString(fromFlag),
|
||||
viper.GetString(toFlag),
|
||||
|
||||
logging.NewLogger().PrintHeader,
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package cmd
|
||||
|
||||
import (
|
||||
"github.com/pojntfx/stfs/internal/keys"
|
||||
"github.com/pojntfx/stfs/internal/logging"
|
||||
"github.com/pojntfx/stfs/pkg/config"
|
||||
"github.com/pojntfx/stfs/pkg/hardware"
|
||||
"github.com/pojntfx/stfs/pkg/recovery"
|
||||
@@ -72,7 +73,7 @@ var recoveryFetchCmd = &cobra.Command{
|
||||
viper.GetString(toFlag),
|
||||
viper.GetBool(previewFlag),
|
||||
|
||||
true,
|
||||
logging.NewLogger().PrintHeader,
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"github.com/pojntfx/stfs/internal/encryption"
|
||||
"github.com/pojntfx/stfs/internal/keys"
|
||||
"github.com/pojntfx/stfs/internal/logging"
|
||||
"github.com/pojntfx/stfs/internal/signature"
|
||||
"github.com/pojntfx/stfs/pkg/config"
|
||||
"github.com/pojntfx/stfs/pkg/recovery"
|
||||
@@ -74,6 +75,8 @@ var recoveryIndexCmd = &cobra.Command{
|
||||
func(hdr *tar.Header, isRegular bool) error {
|
||||
return signature.VerifyHeader(hdr, isRegular, viper.GetString(signatureFlag), recipient)
|
||||
},
|
||||
|
||||
logging.NewLogger().PrintHeader,
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package cmd
|
||||
|
||||
import (
|
||||
"github.com/pojntfx/stfs/internal/keys"
|
||||
"github.com/pojntfx/stfs/internal/logging"
|
||||
"github.com/pojntfx/stfs/pkg/config"
|
||||
"github.com/pojntfx/stfs/pkg/hardware"
|
||||
"github.com/pojntfx/stfs/pkg/recovery"
|
||||
@@ -62,6 +63,8 @@ var recoveryQueryCmd = &cobra.Command{
|
||||
viper.GetInt(recordSizeFlag),
|
||||
viper.GetInt(recordFlag),
|
||||
viper.GetInt(blockFlag),
|
||||
|
||||
logging.NewLogger().PrintHeader,
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package cmd
|
||||
|
||||
import (
|
||||
"github.com/pojntfx/stfs/internal/keys"
|
||||
"github.com/pojntfx/stfs/internal/logging"
|
||||
"github.com/pojntfx/stfs/pkg/config"
|
||||
"github.com/pojntfx/stfs/pkg/operations"
|
||||
"github.com/spf13/cobra"
|
||||
@@ -68,6 +69,8 @@ var restoreCmd = &cobra.Command{
|
||||
viper.GetString(fromFlag),
|
||||
viper.GetString(toFlag),
|
||||
viper.GetBool(flattenFlag),
|
||||
|
||||
logging.NewLogger().PrintHeader,
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
|
||||
"github.com/pojntfx/stfs/internal/compression"
|
||||
"github.com/pojntfx/stfs/internal/keys"
|
||||
"github.com/pojntfx/stfs/internal/logging"
|
||||
"github.com/pojntfx/stfs/internal/persisters"
|
||||
"github.com/pojntfx/stfs/pkg/config"
|
||||
"github.com/pojntfx/stfs/pkg/operations"
|
||||
@@ -85,6 +86,8 @@ var updateCmd = &cobra.Command{
|
||||
viper.GetString(fromFlag),
|
||||
viper.GetBool(overwriteFlag),
|
||||
viper.GetString(compressionLevelFlag),
|
||||
|
||||
logging.NewLogger().PrintHeader,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -128,6 +131,8 @@ var updateCmd = &cobra.Command{
|
||||
func(hdr *tar.Header, isRegular bool) error {
|
||||
return nil // We sign above, no need to verify
|
||||
},
|
||||
|
||||
logging.NewLogger().PrintHeader,
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user