Pass logOutput to Holder.Open

This commit is contained in:
Alan Bernstein 2017-06-23 18:14:59 -05:00
parent b9e853dbdb
commit 855f224778
2 changed files with 4 additions and 3 deletions

View file

@ -70,7 +70,7 @@ func NewHolder() *Holder {
}
// Open initializes the root data directory for the holder.
func (h *Holder) Open() error {
func (h *Holder) Open(logOutput io.Writer) error {
if err := os.MkdirAll(h.Path, 0777); err != nil {
return err
}
@ -87,6 +87,8 @@ func (h *Holder) Open() error {
return err
}
h.LogOutput = logOutput
for _, fi := range fis {
if !fi.IsDir() {
continue

View file

@ -129,7 +129,7 @@ func (s *Server) Open() error {
}
// Open holder.
if err := s.Holder.Open(); err != nil {
if err := s.Holder.Open(s.LogOutput); err != nil {
return fmt.Errorf("opening Holder: %v", err)
}
@ -159,7 +159,6 @@ func (s *Server) Open() error {
// Initialize Holder.
s.Holder.Broadcaster = s.Broadcaster
s.Holder.LogOutput = s.LogOutput
// Serve HTTP.
go func() { http.Serve(ln, s.Handler) }()