func inferWorkerID(name string) string {
	processorRe := regexp.MustCompile(`^processor\..*\.w[0-9]+\..*`)
	if processorRe.MatchString(name) {
		splitName := strings.Split(name, ".")
		return splitName[2][1:]
	}
	return ""
}
InferWorkerID infers the worker ID from the logger name field
e.g.: "processor.http.w5.python.logger" -> 5
package logprocessing
import (
	"bytes"
	"encoding/json"
	"fmt"
	"regexp"
	"strings"
	"time"
	"github.com/nuclio/nuclio/pkg/common"
	"github.com/nuclio/errors"
	"github.com/nuclio/logger"
)
func PrettifyFunctionLogLine(logger logger.Logger, log []byte) (string, string, error) {
	var workerID, briefLogLine string
	functionLogLineInstance, err := CreateFunctionLogLine(log)
	if err != nil {
		return "", "", errors.Wrap(err, "Failed to create function log line")
	}
	if functionLogLineInstance.Time == nil ||
		functionLogLineInstance.Level == nil ||
		functionLogLineInstance.Message == nil {
		return "", "", errors.New("Missing required fields in pod log line")
	}
	parsedTime, err := resolveProcessedLogLineTime(functionLogLineInstance.Time)
	if err != nil {
		return "", "", errors.Wrap(err, "Failed to resolve process log line time")
	}
	logLevel := strings.ToUpper(*functionLogLineInstance.Level)[0]
	if functionLogLineInstance.With != nil {
		workerID = functionLogLineInstance.With["worker_id"]
	}
	if workerID == "" && functionLogLineInstance.Name != nil {
		workerID = inferWorkerID(*functionLogLineInstance.Name)
	}
	messageAndArgs := getMessageAndArgs(logger, functionLogLineInstance, log)
	res := fmt.Sprintf("[%s] (%c) %s", parsedTime.Format("15:04:05.000"), logLevel, messageAndArgs)
	if shouldAddToBriefErrorsMessage(logLevel, *functionLogLineInstance.Message, workerID) {
		briefLogLine = messageAndArgs
	}
	return res, briefLogLine, nil
}
func CreateFunctionLogLine(log []byte) (*FunctionLogLine, error) {
	functionLogLineInstance := &FunctionLogLine{}
	log = formatLogLine(log)
	if err := json.Unmarshal(log, &functionLogLineInstance); err != nil {
		return nil, errors.Wrap(err, "Failed to unmarshal log line")
	}
	if functionLogLineInstance.Datetime != nil {
		unparsedTime := *functionLogLineInstance.Datetime + "Z"
		unparsedTime = strings.Replace(unparsedTime, " ", "T", 1)
		unparsedTime = strings.Replace(unparsedTime, ",", ".", 1)
		functionLogLineInstance.Time = &unparsedTime
	}
	if functionLogLineInstance.With != nil {
		more := createKeyValuePairs(functionLogLineInstance.With)
		functionLogLineInstance.More = &more
	}
	return functionLogLineInstance, nil
}