Commit b3f36211 authored by Alishan Ladhani's avatar Alishan Ladhani 🔴
Browse files

Use template string to generate log message

parent 346a8d98
......@@ -38,6 +38,11 @@ func Info(args ...interface{}) {
logger.Info(args...)
}
// Infof exported method
func Infof(format string, args ...interface{}) {
logger.Infof(format, args...)
}
// Warn exported method
func Warn(args ...interface{}) {
logger.Warn(args...)
......
......@@ -31,6 +31,14 @@ func TestInfo(t *testing.T) {
assert.Contains(t, output.String(), "Test")
}
func TestInfof(t *testing.T) {
output := WithTestLogger(func(logger *Logger) {
logger.SetLevel(logrus.InfoLevel)
logger.Infof("Test %s", "format string")
})
assert.Contains(t, output.String(), "Test format string")
}
func TestWarn(t *testing.T) {
output := WithTestLogger(func(logger *Logger) {
logger.SetLevel(logrus.WarnLevel)
......
......@@ -27,7 +27,7 @@ func (runtime OpenfaasRuntime) Build(ctx context.Context) error {
// FunctionRuntime will look like openfaas/classic/ruby
_, runtimeName := path.Split(runtime.FunctionRuntime)
logger.Info("Using openfaas ", runtimeName, " runtime")
logger.Infof("Using OpenFaaS %s runtime", runtimeName)
err := runtime.writeRuntimeFiles(repository, runtimeName)
if err != nil {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment