github.com/adacta-ru/mattermost-server/v6@v6.0.0/app/plugin_api_tests/test_call_log_api_plugin/main.go (about) 1 // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. 2 // See LICENSE.txt for license information. 3 4 package main 5 6 import ( 7 "github.com/adacta-ru/mattermost-server/v6/model" 8 "github.com/adacta-ru/mattermost-server/v6/plugin" 9 "github.com/pkg/errors" 10 ) 11 12 type PluginUsingLogAPI struct { 13 plugin.MattermostPlugin 14 } 15 16 type Foo struct { 17 bar float64 18 } 19 20 func main() { 21 plugin.ClientMain(&PluginUsingLogAPI{}) 22 } 23 24 func (p *PluginUsingLogAPI) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string) { 25 p.API.LogDebug("LogDebug", "one", 1, "two", "two", "foo", Foo{bar: 3.1416}) 26 p.API.LogInfo("LogInfo", "one", 1, "two", "two", "foo", Foo{bar: 3.1416}) 27 p.API.LogWarn("LogWarn", "one", 1, "two", "two", "foo", Foo{bar: 3.1416}) 28 p.API.LogError("LogError", "error", errors.WithStack(errors.New("boom!"))) 29 return nil, "OK" 30 }