diff options
Diffstat (limited to 'resources/resource_transformers/tocss')
-rw-r--r-- | resources/resource_transformers/tocss/dartsass/client.go | 10 | ||||
-rw-r--r-- | resources/resource_transformers/tocss/dartsass/integration_test.go | 34 |
2 files changed, 23 insertions, 21 deletions
diff --git a/resources/resource_transformers/tocss/dartsass/client.go b/resources/resource_transformers/tocss/dartsass/client.go index 9ae317886..63278f0db 100644 --- a/resources/resource_transformers/tocss/dartsass/client.go +++ b/resources/resource_transformers/tocss/dartsass/client.go @@ -58,6 +58,8 @@ func New(fs *filesystems.SourceFilesystem, rs *resources.Spec) (*Client, error) transpiler *godartsass.Transpiler transpilerv1 *godartsassv1.Transpiler err error + infol = rs.Logger.InfoCommand("Dart Sass") + warnl = rs.Logger.WarnCommand("Dart Sass") ) if hugo.IsDartSassV2() { @@ -68,10 +70,10 @@ func New(fs *filesystems.SourceFilesystem, rs *resources.Spec) (*Client, error) switch event.Type { case godartsass.LogEventTypeDebug: // Log as Info for now, we may adjust this if it gets too chatty. - rs.Logger.Infof("Dart Sass: %s", message) + infol.Logf(message) default: // The rest are either deprecations or @warn statements. - rs.Logger.Warnf("Dart Sass: %s", message) + warnl.Logf(message) } }, }) @@ -84,10 +86,10 @@ func New(fs *filesystems.SourceFilesystem, rs *resources.Spec) (*Client, error) switch event.Type { case godartsassv1.LogEventTypeDebug: // Log as Info for now, we may adjust this if it gets too chatty. - rs.Logger.Infof("Dart Sass: %s", message) + infol.Logf(message) default: // The rest are either deprecations or @warn statements. - rs.Logger.Warnf("Dart Sass: %s", message) + warnl.Logf(message) } }, }) diff --git a/resources/resource_transformers/tocss/dartsass/integration_test.go b/resources/resource_transformers/tocss/dartsass/integration_test.go index d76592336..c370a1cc8 100644 --- a/resources/resource_transformers/tocss/dartsass/integration_test.go +++ b/resources/resource_transformers/tocss/dartsass/integration_test.go @@ -17,10 +17,10 @@ import ( "strings" "testing" + "github.com/bep/logg" qt "github.com/frankban/quicktest" "github.com/gohugoio/hugo/hugolib" "github.com/gohugoio/hugo/resources/resource_transformers/tocss/dartsass" - jww "github.com/spf13/jwalterweatherman" ) func TestTransformIncludePaths(t *testing.T) { @@ -288,11 +288,11 @@ T1: {{ $r.Content }} T: t, TxtarString: files, NeedsOsFS: true, - LogLevel: jww.LevelInfo, + LogLevel: logg.LevelInfo, }).Build() - b.AssertLogMatches(`WARN.*Dart Sass: foo`) - b.AssertLogMatches(`INFO.*Dart Sass: .*assets.*main.scss:1:0: bar`) + b.AssertLogMatches(`Dart Sass: foo`) + b.AssertLogMatches(`Dart Sass: .*assets.*main.scss:1:0: bar`) } @@ -513,20 +513,20 @@ T1: {{ $r.Content }} T: t, TxtarString: files, NeedsOsFS: true, - LogLevel: jww.LevelInfo, + LogLevel: logg.LevelInfo, }).Build() - b.AssertLogMatches(`INFO.*Dart Sass: .*assets.*main.scss:3:0: color`) - b.AssertLogMatches(`INFO.*Dart Sass: .*assets.*main.scss:4:0: color`) - b.AssertLogMatches(`INFO.*Dart Sass: .*assets.*main.scss:5:0: color`) - b.AssertLogMatches(`INFO.*Dart Sass: .*assets.*main.scss:6:0: number`) - b.AssertLogMatches(`INFO.*Dart Sass: .*assets.*main.scss:7:0: number`) - b.AssertLogMatches(`INFO.*Dart Sass: .*assets.*main.scss:8:0: number`) - b.AssertLogMatches(`INFO.*Dart Sass: .*assets.*main.scss:9:0: string`) - b.AssertLogMatches(`INFO.*Dart Sass: .*assets.*main.scss:10:0: string`) - b.AssertLogMatches(`INFO.*Dart Sass: .*assets.*main.scss:11:0: string`) - b.AssertLogMatches(`INFO.*Dart Sass: .*assets.*main.scss:12:0: number`) - b.AssertLogMatches(`INFO.*Dart Sass: .*assets.*main.scss:13:0: number`) - b.AssertLogMatches(`INFO.*Dart Sass: .*assets.*main.scss:14:0: number`) + b.AssertLogMatches(`Dart Sass: .*assets.*main.scss:3:0: color`) + b.AssertLogMatches(`Dart Sass: .*assets.*main.scss:4:0: color`) + b.AssertLogMatches(`Dart Sass: .*assets.*main.scss:5:0: color`) + b.AssertLogMatches(`Dart Sass: .*assets.*main.scss:6:0: number`) + b.AssertLogMatches(`Dart Sass: .*assets.*main.scss:7:0: number`) + b.AssertLogMatches(`Dart Sass: .*assets.*main.scss:8:0: number`) + b.AssertLogMatches(`Dart Sass: .*assets.*main.scss:9:0: string`) + b.AssertLogMatches(`Dart Sass: .*assets.*main.scss:10:0: string`) + b.AssertLogMatches(`Dart Sass: .*assets.*main.scss:11:0: string`) + b.AssertLogMatches(`Dart Sass: .*assets.*main.scss:12:0: number`) + b.AssertLogMatches(`Dart Sass: .*assets.*main.scss:13:0: number`) + b.AssertLogMatches(`Dart Sass: .*assets.*main.scss:14:0: number`) } |