Skip to content
This repository has been archived by the owner on Jan 11, 2021. It is now read-only.

Commit

Permalink
Removing unnecessary commas and line endings from log.
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdanguranda committed Feb 13, 2018
1 parent d2da528 commit bf646db
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func main() {
}
err := app.Run(os.Args)
if err != nil {
log.Fatalf("App could not start, error=[%v]\n", err)
log.Fatalf("App could not start, error=[%v]", err)
}
}

Expand Down
2 changes: 1 addition & 1 deletion routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ func (r routing) routProdEndpoints() {
func (r routing) listenAndServe(port string) {
err := http.ListenAndServe(":"+port, r.router)
if err != nil {
log.Fatalf("Error during ListenAndServe: %v\n", err)
log.Fatalf("Error during ListenAndServe: %v", err)
}
}
20 changes: 10 additions & 10 deletions unfolder.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,29 +65,29 @@ func (u *unfolder) handle(writer http.ResponseWriter, req *http.Request) {
writer.Header().Add("Content-Type", "application/json;charset=utf-8")

if err := uuidutils.ValidateUUID(uuid); err != nil {
log.Errorf("Message with tid=%v, contentCollectionUuid=%v, collectionType=%v. Invalid uuid in request path: %v", tid, uuid, collectionType, err)
log.Errorf("Message with tid=%v contentCollectionUuid=%v collectionType=%v Invalid uuid in request path: %v", tid, uuid, collectionType, err)
writeError(writer, http.StatusBadRequest, err)
return
}

defer req.Body.Close()
body, err := ioutil.ReadAll(req.Body)
if err != nil {
log.Errorf("Message with tid=%v, contentCollectionUuid=%v, collectionType=%v. Unable to extract request body: %v", tid, uuid, collectionType, err)
log.Errorf("Message with tid=%v contentCollectionUuid=%v collectionType=%v Unable to extract request body: %v", tid, uuid, collectionType, err)
writeError(writer, http.StatusUnprocessableEntity, err)
return
}

uuidsAndDate, err := u.uuidsAndDateRes.Resolve(body)
if err != nil {
log.Errorf("Message with tid=%v, contentCollectionUuid=%v, collectionType=%v. Error while resolving UUIDs: %v", tid, uuid, collectionType, err)
log.Errorf("Message with tid=%v contentCollectionUuid=%v collectionType=%v Error while resolving UUIDs: %v", tid, uuid, collectionType, err)
writeError(writer, http.StatusBadRequest, err)
return
}

oldCollectionRelations, err := u.relationsResolver.Resolve(uuid, tid)
if err != nil {
log.Errorf("Message with tid=%v, contentCollectionUuid=%v, collectionType=%v. Error while fetching old collection relations: %v", tid, uuid, collectionType, err)
log.Errorf("Message with tid=%v contentCollectionUuid=%v collectionType=%v Error while fetching old collection relations: %v", tid, uuid, collectionType, err)
writeError(writer, http.StatusInternalServerError, err)
return
}
Expand All @@ -96,19 +96,19 @@ func (u *unfolder) handle(writer http.ResponseWriter, req *http.Request) {

fwResp, err := u.forwarder.Forward(tid, uuid, collectionType, body)
if err != nil {
log.Errorf("Message with tid=%v, contentCollectionUuid=%v, collectionType=%v. Error during forwarding: %v", tid, uuid, collectionType, err)
log.Errorf("Message with tid=%v contentCollectionUuid=%v collectionType=%v Error during forwarding: %v", tid, uuid, collectionType, err)
writeError(writer, http.StatusInternalServerError, err)
return
}

if fwResp.Status != http.StatusOK {
log.Warnf("Message with tid=%v, contentCollectionUuid=%v, collectionType=%v. Skip unfolding. Writer returned status [%v]", tid, uuid, collectionType, fwResp.Status)
log.Warnf("Message with tid=%v contentCollectionUuid=%v collectionType=%v Skip unfolding. Writer returned status [%v]", tid, uuid, collectionType, fwResp.Status)
writeResponse(writer, fwResp.Status, fwResp.ResponseBody)
return
}

if _, ok := u.whitelist[collectionType]; !ok {
log.Infof("Message with tid=%v, contentCollectionUuid=%v, collectionType=%v. Skip unfolding. Collection type [%v] not in unfolding whitelist", tid, uuid, collectionType, collectionType)
log.Infof("Message with tid=%v contentCollectionUuid=%v collectionType=%v Skip unfolding. Collection type [%v] not in unfolding whitelist", tid, uuid, collectionType, collectionType)
writeResponse(writer, fwResp.Status, fwResp.ResponseBody)
return
}
Expand All @@ -118,19 +118,19 @@ func (u *unfolder) handle(writer http.ResponseWriter, req *http.Request) {
}

if diffUuidsSet.Len() == 0 {
log.Infof("Message with tid=%v, contentCollectionUuid=%v, collectionType=%v. Skip unfolding. No uuids to resolve after diff was done.", tid, uuid, collectionType)
log.Infof("Message with tid=%v contentCollectionUuid=%v collectionType=%v Skip unfolding. No uuids to resolve after diff was done.", tid, uuid, collectionType)
writeResponse(writer, http.StatusOK, fwResp.ResponseBody)
return
}

resolvedContentArr, err := u.contentRes.ResolveContents(flattenToStringSlice(diffUuidsSet), tid)
if err != nil {
log.Errorf("Message with tid=%v, contentCollectionUuid=%v, collectionType=%v. Error while resolving contents: %v", tid, uuid, collectionType, err)
log.Errorf("Message with tid=%v contentCollectionUuid=%v collectionType=%v Error while resolving contents: %v", tid, uuid, collectionType, err)
writeError(writer, http.StatusInternalServerError, err)
return
}

log.Infof("Message with tid=%v, contentCollectionUuid=%v, collectionType=%v. Done unfolding. Preparing to send messages.", tid, uuid, collectionType)
log.Infof("Message with tid=%v contentCollectionUuid=%v collectionType=%v Done unfolding. Preparing to send messages.", tid, uuid, collectionType)

u.producer.Send(tid, uuidsAndDate.LastModified, resolvedContentArr)
}
Expand Down

0 comments on commit bf646db

Please sign in to comment.