summaryrefslogtreecommitdiffstats
path: root/model/client4.go
diff options
context:
space:
mode:
Diffstat (limited to 'model/client4.go')
-rw-r--r--model/client4.go12
1 files changed, 12 insertions, 0 deletions
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.