...

Package logs

Overview ▾

type Client

type Client interface {
    DisplayLogs(
        ctx context.Context,
        mode string,
        componentName string,
        namespace string,
        follow bool,
        out io.Writer,
    ) error

    // GetLogsForMode gets logs of the containers for the specified mode (Dev, Deploy or both) of the provided
    // component name and namespace. It returns Events which has multiple channels. Logs are put on the
    // Events.Logs channel and errors on Events.Err. Events.Done channel is populated to indicate that all Pods' logs
    // have been fetched.
    // The accepted values for mode are ComponentDevMode, ComponentDeployMode and ComponentAnyMode
    // found in the pkg/labels package.
    // Setting follow boolean to true helps follow/tail the logs of the pods.
    GetLogsForMode(
        ctx context.Context,
        mode string,
        componentName string,
        namespace string,
        follow bool,
    ) (Events, error)
}

type ContainerLogs

type ContainerLogs struct {
    PodName       string
    ContainerName string
    Logs          io.ReadCloser
}

type Events

type Events struct {
    // channel to put the container logs on
    Logs chan ContainerLogs
    // channel to put an error on, if any
    Err chan error
    // channel to indicate that logs for all pods have been grabbed; not to be populated if --follow is used
    Done chan struct{}
}

type InvalidModeError

type InvalidModeError struct {
    // contains filtered or unexported fields
}

func (InvalidModeError) Error

func (e InvalidModeError) Error() string

type LogsClient

type LogsClient struct {
    // contains filtered or unexported fields
}

func NewLogsClient

func NewLogsClient(platformClient platform.Client) *LogsClient

func (*LogsClient) DisplayLogs

func (o *LogsClient) DisplayLogs(
    ctx context.Context,
    mode string,
    componentName string,
    namespace string,
    follow bool,
    out io.Writer,
) error

func (*LogsClient) GetLogsForMode

func (o *LogsClient) GetLogsForMode(
    ctx context.Context,
    mode string,
    componentName string,
    namespace string,
    follow bool,
) (Events, error)