diff --git a/CHANGELOG.md b/CHANGELOG.md index 746f42bd..b6682292 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## v1.0.1 + +### logger + +* Fix plugin system, use pointer instead of value for manager + ## v1.0.0 ### mongo (api change) diff --git a/logger/plugin.go b/logger/plugin.go index d1ca0d40..13562f56 100644 --- a/logger/plugin.go +++ b/logger/plugin.go @@ -6,10 +6,10 @@ import ( "github.com/sirupsen/logrus" ) -var plugins = PluginManager{} +var plugins = &PluginManager{} // Plugins is the entrypoint to the global PluginManager -func Plugins() PluginManager { +func Plugins() *PluginManager { return plugins } @@ -25,7 +25,7 @@ type PluginManager struct { } // RegisterPlugin add a plugin to the current plugin list, if the plugin is already in memory, he will skip the add part -func (m PluginManager) RegisterPlugin(plugin Plugin) { +func (m *PluginManager) RegisterPlugin(plugin Plugin) { m.lock.Lock() defer m.lock.Unlock() @@ -39,7 +39,7 @@ func (m PluginManager) RegisterPlugin(plugin Plugin) { } // Hooks return all the hooks generated by the plugins -func (m PluginManager) Hooks() []logrus.Hook { +func (m *PluginManager) Hooks() []logrus.Hook { m.lock.Lock() defer m.lock.Unlock()