github.com/rajatvaryani/mattermost-server@v5.11.1+incompatible/model/bundle_info.go (about) 1 // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. 2 // See License.txt for license information. 3 4 package model 5 6 import "github.com/mattermost/mattermost-server/mlog" 7 8 type BundleInfo struct { 9 Path string 10 11 Manifest *Manifest 12 ManifestPath string 13 ManifestError error 14 } 15 16 func (b *BundleInfo) WrapLogger(logger *mlog.Logger) *mlog.Logger { 17 if b.Manifest != nil { 18 return logger.With(mlog.String("plugin_id", b.Manifest.Id)) 19 } 20 return logger.With(mlog.String("plugin_path", b.Path)) 21 } 22 23 // Returns bundle info for the given path. The return value is never nil. 24 func BundleInfoForPath(path string) *BundleInfo { 25 m, mpath, err := FindManifest(path) 26 return &BundleInfo{ 27 Path: path, 28 Manifest: m, 29 ManifestPath: mpath, 30 ManifestError: err, 31 } 32 }