dmohan001c commented on a change in pull request #6235:
URL: https://github.com/apache/trafficcontrol/pull/6235#discussion_r717739959



##########
File path: traffic_ops/traffic_ops_golang/logs/log.go
##########
@@ -79,6 +78,35 @@ func Get(w http.ResponseWriter, r *http.Request) {
        }
 }
 
+// Get is the handler for GET requests to /logs V4.0.
+func Getv40(w http.ResponseWriter, r *http.Request) {
+       inf, userErr, sysErr, errCode := api.NewInfo(r, nil, []string{"days", 
"limit"})
+       if userErr != nil || sysErr != nil {
+               api.HandleErr(w, r, inf.Tx.Tx, errCode, userErr, sysErr)
+               return
+       }
+       defer inf.Close()
+       days := DefaultLogDays
+       if pDays, ok := inf.IntParams["days"]; ok {
+               days = pDays
+       }
+
+       a := tc.Alerts{}
+       setLastSeenCookie(w)
+       logs, count, err := getLogV40(inf, days)
+
+       if err != nil {
+               a.AddNewAlert(tc.ErrorLevel, err.Error())
+               api.WriteAlerts(w, r, http.StatusInternalServerError, a)

Review comment:
       Fixed.

##########
File path: traffic_ops/traffic_ops_golang/logs/log.go
##########
@@ -79,6 +78,35 @@ func Get(w http.ResponseWriter, r *http.Request) {
        }
 }
 
+// Get is the handler for GET requests to /logs V4.0.
+func Getv40(w http.ResponseWriter, r *http.Request) {
+       inf, userErr, sysErr, errCode := api.NewInfo(r, nil, []string{"days", 
"limit"})
+       if userErr != nil || sysErr != nil {
+               api.HandleErr(w, r, inf.Tx.Tx, errCode, userErr, sysErr)
+               return
+       }
+       defer inf.Close()
+       days := DefaultLogDays
+       if pDays, ok := inf.IntParams["days"]; ok {
+               days = pDays
+       }
+
+       a := tc.Alerts{}
+       setLastSeenCookie(w)
+       logs, count, err := getLogV40(inf, days)
+
+       if err != nil {
+               a.AddNewAlert(tc.ErrorLevel, err.Error())
+               api.WriteAlerts(w, r, http.StatusInternalServerError, a)
+               return
+       }
+       if a.HasAlerts() {

Review comment:
       Fixed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to