From 6a8423f51c116333dc7efc7a8224fc842298b192 Mon Sep 17 00:00:00 2001 From: Reed Allman Date: Sun, 11 Jun 2017 17:58:03 -0700 Subject: [PATCH] spew spew --- api/runner/func_logger.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/api/runner/func_logger.go b/api/runner/func_logger.go index 9151f4870..e31b1a335 100644 --- a/api/runner/func_logger.go +++ b/api/runner/func_logger.go @@ -6,7 +6,9 @@ import ( "errors" "io" + "github.com/Sirupsen/logrus" "gitlab-odx.oracle.com/odx/functions/api/models" + "gitlab-odx.oracle.com/odx/functions/api/runner/common" ) type FuncLogger interface { @@ -42,10 +44,16 @@ func (w *writer) Write(b []byte) (int, error) { // for now, also write to stderr so we can debug quick ;) // TODO this should be a separate FuncLogger but time is running short ! - //log := common.Logger(w.ctx) - //log = log.WithFields(logrus.Fields{"user_log": true, "app_name": w.appName, - //"path": w.path, "image": w.image, "call_id": w.reqID}) - //log.Println(string(b)) + log := common.Logger(w.ctx) + log = log.WithFields(logrus.Fields{"user_log": true, "app_name": w.appName, "path": w.path, "image": w.image, "call_id": w.reqID}) + for i := 0; i < len(b); i++ { + j := i + i = bytes.IndexByte(b[i:], '\n') + if i < 0 { + i = len(b) + } + log.Println(string(b[j:i])) + } return n, err }