MM-57013 Added download button for downloading logs from server logs page in system console (#26389)
* added download system logs * download all logs * download all logs check-lint fix * check lint fix * download logs api * download logs api working * download logs working with error log * linting issues and code cleanup * CI check fix * documented the api and logs from file with error handling * test and final changes done * final changes done * Fix order of server-side translations * Fix incorrect indentation of logs.yaml --------- Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
71c25fb316
Коммит
a8b18ac807
@@ -5862,6 +5862,20 @@ func (c *Client4) GetLogs(ctx context.Context, page, perPage int) ([]string, *Re
|
||||
return c.ArrayFromJSON(r.Body), BuildResponse(r), nil
|
||||
}
|
||||
|
||||
// Download logs as mattermost.log file
|
||||
func (c *Client4) DownloadLogs(ctx context.Context) ([]byte, *Response, error) {
|
||||
r, err := c.DoAPIGet(ctx, "/logs/download", "")
|
||||
if err != nil {
|
||||
return nil, BuildResponse(r), err
|
||||
}
|
||||
data, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
return nil, BuildResponse(r), NewAppError("DownloadLogs", "model.client.read_file.app_error", nil, "", r.StatusCode).Wrap(err)
|
||||
}
|
||||
|
||||
return data, BuildResponse(r), nil
|
||||
}
|
||||
|
||||
// PostLog is a convenience Web Service call so clients can log messages into
|
||||
// the server-side logs. For example we typically log javascript error messages
|
||||
// into the server-side. It returns the log message if the logging was successful.
|
||||
|
||||
Ссылка в новой задаче
Block a user