feat: logging

This commit is contained in:
Anatoly Antonov 2025-03-26 17:44:05 +03:00
parent 778d5ef146
commit fe5e40162b
10 changed files with 151 additions and 75 deletions

View file

@ -48,9 +48,9 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
break
}
switch elem[0] {
case '/': // Prefix: "/s"
case '/': // Prefix: "/api/v1/s"
if l := len("/s"); len(elem) >= l && elem[0:l] == "/s" {
if l := len("/api/v1/s"); len(elem) >= l && elem[0:l] == "/api/v1/s" {
elem = elem[l:]
} else {
break
@ -246,9 +246,9 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
break
}
switch elem[0] {
case '/': // Prefix: "/s"
case '/': // Prefix: "/api/v1/s"
if l := len("/s"); len(elem) >= l && elem[0:l] == "/s" {
if l := len("/api/v1/s"); len(elem) >= l && elem[0:l] == "/api/v1/s" {
elem = elem[l:]
} else {
break
@ -272,7 +272,7 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
r.name = GetSatellitesOperation
r.summary = "Get available satellites"
r.operationID = "GetSatellites"
r.pathPattern = "/satellite"
r.pathPattern = "/api/v1/satellite"
r.args = args
r.count = 0
return r, true
@ -296,7 +296,7 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
r.name = SubscribeSatelliteOperation
r.summary = "Subscribe to a given station"
r.operationID = "SubscribeSatellite"
r.pathPattern = "/satellite/subscribe"
r.pathPattern = "/api/v1/satellite/subscribe"
r.args = args
r.count = 0
return r, true
@ -321,7 +321,7 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
r.name = GetStationsOperation
r.summary = "Get available stations"
r.operationID = "GetStations"
r.pathPattern = "/station"
r.pathPattern = "/api/v1/station"
r.args = args
r.count = 0
return r, true
@ -345,7 +345,7 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
r.name = SubscribeStationOperation
r.summary = "Subscribe to a given station"
r.operationID = "SubscribeStation"
r.pathPattern = "/station/subscribe"
r.pathPattern = "/api/v1/station/subscribe"
r.args = args
r.count = 0
return r, true
@ -371,7 +371,7 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
r.name = UnsubscribeOperation
r.summary = "Remove subscription by subscription ID"
r.operationID = "Unsubscribe"
r.pathPattern = "/subscription"
r.pathPattern = "/api/v1/subscription"
r.args = args
r.count = 0
return r, true
@ -379,7 +379,7 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) {
r.name = GetSubscriptionsOperation
r.summary = "Get current subscriptions"
r.operationID = "GetSubscriptions"
r.pathPattern = "/subscription"
r.pathPattern = "/api/v1/subscription"
r.args = args
r.count = 0
return r, true