From b57b5abce814cfcdf3889d4e267492e809245593 Mon Sep 17 00:00:00 2001 From: Carlos Tadeu Panato Junior Date: Fri, 21 Apr 2017 11:16:35 +0200 Subject: implement POST /logs for apiV4 (#6143) --- model/client4.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'model/client4.go') diff --git a/model/client4.go b/model/client4.go index 04615f9e4..ac5ebf03e 100644 --- a/model/client4.go +++ b/model/client4.go @@ -2229,6 +2229,18 @@ func (c *Client4) GetLogs(page, perPage int) ([]string, *Response) { } } +// 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. +func (c *Client4) PostLog(message map[string]string) (map[string]string, *Response) { + if r, err := c.DoApiPost("/logs", MapToJson(message)); err != nil { + return nil, &Response{StatusCode: r.StatusCode, Error: err} + } else { + defer closeBody(r) + return MapFromJson(r.Body), BuildResponse(r) + } +} + // OAuth Section // CreateOAuthApp will register a new OAuth 2.0 client application with Mattermost acting as an OAuth 2.0 service provider. -- cgit v1.2.3-1-g7c22