github.com/ranjib/nomad@v0.1.1-0.20160225204057-97751b02f70b/client/driver/logging/collector_windows.go (about)

     1  package logging
     2  
     3  import (
     4  	"log"
     5  
     6  	"github.com/hashicorp/nomad/client/allocdir"
     7  	cstructs "github.com/hashicorp/nomad/client/driver/structs"
     8  	"github.com/hashicorp/nomad/nomad/structs"
     9  )
    10  
    11  // LogCollectorContext holds context to configure the syslog server
    12  type LogCollectorContext struct {
    13  	// TaskName is the name of the Task
    14  	TaskName string
    15  
    16  	// AllocDir is the handle to do operations on the alloc dir of
    17  	// the task
    18  	AllocDir *allocdir.AllocDir
    19  
    20  	// LogConfig provides configuration related to log rotation
    21  	LogConfig *structs.LogConfig
    22  
    23  	// PortUpperBound is the upper bound of the ports that we can use to start
    24  	// the syslog server
    25  	PortUpperBound uint
    26  
    27  	// PortLowerBound is the lower bound of the ports that we can use to start
    28  	// the syslog server
    29  	PortLowerBound uint
    30  }
    31  
    32  // SyslogCollectorState holds the address and islation information of a launched
    33  // syslog server
    34  type SyslogCollectorState struct {
    35  	IsolationConfig *cstructs.IsolationConfig
    36  	Addr            string
    37  }
    38  
    39  // LogCollector is an interface which allows a driver to launch a log server
    40  // and update log configuration
    41  type LogCollector interface {
    42  	LaunchCollector(ctx *LogCollectorContext) (*SyslogCollectorState, error)
    43  	Exit() error
    44  	UpdateLogConfig(logConfig *structs.LogConfig) error
    45  }
    46  
    47  // SyslogCollector is a LogCollector which starts a syslog server and does
    48  // rotation to incoming stream
    49  type SyslogCollector struct {
    50  }
    51  
    52  // NewSyslogCollector returns an implementation of the SyslogCollector
    53  func NewSyslogCollector(logger *log.Logger) *SyslogCollector {
    54  	return &SyslogCollector{}
    55  }
    56  
    57  // LaunchCollector launches a new syslog server and starts writing log lines to
    58  // files and rotates them
    59  func (s *SyslogCollector) LaunchCollector(ctx *LogCollectorContext) (*SyslogCollectorState, error) {
    60  	return nil, nil
    61  }
    62  
    63  // Exit kills the syslog server
    64  func (s *SyslogCollector) Exit() error {
    65  	return nil
    66  }
    67  
    68  // UpdateLogConfig updates the log configuration
    69  func (s *SyslogCollector) UpdateLogConfig(logConfig *structs.LogConfig) error {
    70  	return nil
    71  }