actualise godoc comment for api.logHandler func

This commit is contained in:
Sergey Krashevich
2023-12-05 17:54:53 +03:00
parent 0a8ab9bbd1
commit fc5b36acd3

View File

@@ -247,18 +247,16 @@ func restartHandler(w http.ResponseWriter, r *http.Request) {
go shell.Restart() go shell.Restart()
} }
// logHandler handles HTTP requests for log file operations. // logHandler handles HTTP requests for log buffer operations.
// It supports two HTTP methods: // It supports two HTTP methods:
// - GET: Retrieves the content of the log file and sends it back to the client as plain text. // - GET: Retrieves the content of in-memory log and sends it back to the client as plain text.
// - DELETE: Deletes the log file from the server. // - DELETE: Clear the in-memory log buffer.
// //
// The function expects a valid http.ResponseWriter and an http.Request as parameters. // The function expects a valid http.ResponseWriter and an http.Request as parameters.
// For a GET request, it reads the log file specified by app.GetLogFilepath() and writes // For a GET request, it reads the log from in-memory buffer and writes
// the content to the response writer with a "text/plain" content type. If the log file // the content to the response writer with a "text/plain" content type.
// cannot be read, it responds with an HTTP 404 (Not Found) status.
// //
// For a DELETE request, it attempts to delete the log file. If the deletion fails, // For a DELETE request, it clears the in-memory buffer.
// it responds with an HTTP 503 (Service Unavailable) status.
// //
// For any other HTTP method, it responds with an HTTP 400 (Bad Request) status. // For any other HTTP method, it responds with an HTTP 400 (Bad Request) status.
// //