github.com/smithx10/nomad@v0.9.1-rc1/client/logmon/client.go (about)

     1  package logmon
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/hashicorp/nomad/client/logmon/proto"
     7  )
     8  
     9  type logmonClient struct {
    10  	client proto.LogMonClient
    11  }
    12  
    13  func (c *logmonClient) Start(cfg *LogConfig) error {
    14  	req := &proto.StartRequest{
    15  		LogDir:         cfg.LogDir,
    16  		StdoutFileName: cfg.StdoutLogFile,
    17  		StderrFileName: cfg.StderrLogFile,
    18  		MaxFiles:       uint32(cfg.MaxFiles),
    19  		MaxFileSizeMb:  uint32(cfg.MaxFileSizeMB),
    20  		StdoutFifo:     cfg.StdoutFifo,
    21  		StderrFifo:     cfg.StderrFifo,
    22  	}
    23  	_, err := c.client.Start(context.Background(), req)
    24  	return err
    25  }
    26  
    27  func (c *logmonClient) Stop() error {
    28  	req := &proto.StopRequest{}
    29  	_, err := c.client.Stop(context.Background(), req)
    30  	return err
    31  }