Skip to content

Commit

Permalink
Merge 602ff4e into d7a5c54
Browse files Browse the repository at this point in the history
  • Loading branch information
olgashtivelman committed Jul 10, 2018
2 parents d7a5c54 + 602ff4e commit ee8f077
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ func main() {
panic(fmt.Errorf("Failed to setup log dir"))
}
}

defer utils.InitUbiquityServerLogger()()

logger := logs.GetLogger()
oldLogger := utils.SetupOldLogger("ubiquity")

Expand Down
1 change: 1 addition & 0 deletions resources/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,4 +323,5 @@ type FlexVolumeDetachRequest struct {

type RequestContext struct {
Id string
ActionName string
}
23 changes: 15 additions & 8 deletions utils/logs/go_logging_logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,21 @@ func (l *goLoggingLogger) getContextStringFromGoid() string {
go_id := GetGoID()
context, exists := GoIdToRequestIdMap.Load(go_id)
if !exists {
context = resources.RequestContext{Id: "NA"}
} else {
context = context.(resources.RequestContext)
context = resources.RequestContext{Id: "NA", ActionName: "NA"}
}

new_context := context.(resources.RequestContext)
if new_context.ActionName == "" {
new_context.ActionName = "NA"
}
if l.params.ShowGoid {
return fmt.Sprintf("%s:%d", context.(resources.RequestContext).Id, go_id)
if new_context.Id == "" {
new_context.Id = "NA"
}

if l.params.ShowGoid{
return fmt.Sprintf("%s:%d-%s", new_context.Id, go_id, new_context.ActionName)
} else {
return fmt.Sprintf("%s", context.(resources.RequestContext).Id)
return fmt.Sprintf("%s-%s", new_context.Id, new_context.ActionName)
}
}

Expand Down Expand Up @@ -149,7 +156,7 @@ func getLevel(level Level) logging.Level {
}
}

func GetNewRequestContext() resources.RequestContext {
func GetNewRequestContext(actionName string) resources.RequestContext{
request_uuid := fmt.Sprintf("%s", uuid.NewUUID())
return resources.RequestContext{Id: request_uuid}
return resources.RequestContext{Id: request_uuid, ActionName : actionName}
}

0 comments on commit ee8f077

Please sign in to comment.