Get server logs sending over the socket. wowee

This commit is contained in:
Dane Everitt
2019-04-20 14:57:37 -07:00
parent 342c44abfb
commit b20bfac36b
4 changed files with 80 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
package server
import (
"github.com/olebedev/emitter"
"github.com/patrickmn/go-cache"
"github.com/pkg/errors"
"github.com/pterodactyl/wings/config"
@@ -60,6 +61,8 @@ type Server struct {
// Server cache used to store frequently requested information in memory and make
// certain long operations return faster. For example, FS disk space usage.
cache *cache.Cache
emitter *emitter.Emitter
}
// The build settings for a given server that impact docker container creation and
@@ -257,3 +260,13 @@ func (s *Server) IsBootable() bool {
func (s *Server) CreateEnvironment() error {
return s.environment.Create()
}
// Returns the server event emitter instance. If one has not been setup yet, a new instance
// will be created.
func (s *Server) Emitter() *emitter.Emitter {
if s.emitter == nil {
s.emitter = &emitter.Emitter{}
}
return s.emitter
}