Documentation ¶
Index ¶
- Constants
- func NewSafeSender(baseSender send.Sender, opts BaseOptions) (send.Sender, error)
- type Archive
- type ArchiveFormat
- type BaseOptions
- type BufferOptions
- type BuildloggerV2Options
- type Cache
- type CachedLogger
- type Command
- type CommandPostHook
- type CommandPreHook
- type Create
- func (opts *Create) AddEnvVar(k, v string)
- func (opts *Create) Close() error
- func (opts *Create) Copy() *Create
- func (opts *Create) Hash() hash.Hash
- func (opts *Create) RegisterCloser(fn func() error)
- func (opts *Create) Resolve(ctx context.Context) (exe executor.Executor, t time.Time, resolveErr error)
- func (opts *Create) ResolveEnvironment() []string
- func (opts *Create) Validate() error
- type DefaultLoggerOptions
- type Download
- type FileLoggerOptions
- type Filter
- type InMemoryLoggerOptions
- type InheritedLoggerOptions
- type LogFormat
- type LoggerConfig
- func (lc *LoggerConfig) MarshalBSON() ([]byte, error)
- func (lc *LoggerConfig) MarshalJSON() ([]byte, error)
- func (lc *LoggerConfig) Producer() LoggerProducer
- func (lc *LoggerConfig) Resolve() (send.Sender, error)
- func (lc *LoggerConfig) Set(producer LoggerProducer) error
- func (lc *LoggerConfig) Type() string
- func (lc *LoggerConfig) UnmarshalBSON(b []byte) error
- func (lc *LoggerConfig) UnmarshalJSON(b []byte) error
- type LoggerProducer
- type LoggerProducerFactory
- type LoggerRegistry
- type LoggingPayload
- type LoggingPayloadFormat
- type MongoDBDownload
- type Output
- type RawLoggerConfig
- type RawLoggerConfigFormat
- type Remote
- type RemoteConfig
- type SafeSender
- type SplunkLoggerOptions
- type WriteFile
Constants ¶
const ( // ProcessImplementationBlocking suggests that the process // constructor use a blocking implementation. Some managers // may override this option. Blocking implementations // typically require the manager to maintain multiple // go routines. ProcessImplementationBlocking = "blocking" // ProcessImplementationBasic suggests that the process // constructor use a basic implementation. Some managers // may override this option. Basic implementations are more // simple than blocking implementations. ProcessImplementationBasic = "basic" )
const ( LoggingPayloadFormatBSON = "bson" LoggingPayloadFormatJSON = "json" LoggingPayloadFormatString = "string" )
Constants representing logging payload formats for SendMessages.
const (
// DefaultLogName is the default name for logs emitted by Jasper.
DefaultLogName = "jasper"
)
const LogBuildloggerV2 = "buildloggerv2"
LogBuildloggerV2 is the name for the Buildlogger v2 logger.
const LogDefault = "default"
LogDefault is the name for the default logger.
const LogFile = "file"
LogFile is the name for the file logger.
const LogInMemory = "in-memory"
LogInMemory is the name for the in-memory logger.
const LogInherited = "inherited"
LogInherited is the name for the inherited logger.
const LogSplunk = "splunk"
LogSplunk is the name for the Splunk logger.
Variables ¶
This section is empty.
Functions ¶
func NewSafeSender ¶
NewSafeSender returns a grip send.Sender with the given base options. It overwrites the underlying Close method in order to ensure that both the base sender and buffered sender are closed correctly.
Types ¶
type Archive ¶
type Archive struct { ShouldExtract bool Format ArchiveFormat TargetPath string }
Archive encapsulates options related to management of archive files.
type ArchiveFormat ¶
type ArchiveFormat string
ArchiveFormat represents an archive file type.
const ( // ArchiveAuto is an ArchiveFormat that does not force any particular type of // archive format. ArchiveAuto ArchiveFormat = "auto" // ArchiveTarGz is an ArchiveFormat for gzipped tar archives. ArchiveTarGz ArchiveFormat = "targz" // ArchiveZip is an ArchiveFormat for Zip archives. ArchiveZip ArchiveFormat = "zip" )
func (ArchiveFormat) Validate ¶
func (f ArchiveFormat) Validate() error
Validate checks that the ArchiveFormat is a recognized format.
type BaseOptions ¶
type BaseOptions struct { Level send.LevelInfo `json:"level" bson:"level"` Buffer BufferOptions `json:"buffer" bson:"buffer"` Format LogFormat `json:"format" bson:"format"` }
BaseOptions are the base options necessary for setting up most loggers.
func (*BaseOptions) Validate ¶
func (opts *BaseOptions) Validate() error
Validate ensures that BaseOptions is valid.
type BufferOptions ¶
type BufferOptions struct { Buffered bool `bson:"buffered" json:"buffered" yaml:"buffered"` Duration time.Duration `bson:"duration" json:"duration" yaml:"duration"` MaxSize int `bson:"max_size" json:"max_size" yaml:"max_size"` }
BufferOptions packages options for whether or not a Logger should be buffered and the duration and size of the respective buffer in the case that it should be.
func (*BufferOptions) Validate ¶
func (opts *BufferOptions) Validate() error
Validate ensures that BufferOptions is valid.
type BuildloggerV2Options ¶
type BuildloggerV2Options struct { Buildlogger send.BuildloggerConfig `json:"buildlogger" bson:"buildlogger"` Base BaseOptions `json:"base" bson:"base"` }
BuildloggerV2Options encapsulates the options for creating a Buildlogger v2 logger.
func (*BuildloggerV2Options) Configure ¶
func (opts *BuildloggerV2Options) Configure() (send.Sender, error)
Configure returns a send.Sender based on the Buildlogger v2 options.
func (*BuildloggerV2Options) Type ¶
func (*BuildloggerV2Options) Type() string
Type returns the log type for the Buildlogger v2.
type Cache ¶
type Cache struct { Disabled bool `json:"disabled"` PruneDelay time.Duration `json:"prune_delay"` MaxSize int `json:"max_size"` }
Cache represent the configuration options for the LRU cache.
type CachedLogger ¶
type CachedLogger struct { ID string `bson:"id" json:"id" yaml:"id"` ManagerID string `bson:"manager_id" json:"manager_id" yaml:"manager_id"` Accessed time.Time `bson:"accessed" json:"accessed" yaml:"accessed"` // These are not set if the CachedLogger is returned from a remote // manager. Error send.Sender `bson:"-" json:"-" yaml:"-"` Output send.Sender `bson:"-" json:"-" yaml:"-"` }
CachedLogger is the cached item representing a process's output. It captures information about the cached item, as well as interfaces for sending log messages.
func (*CachedLogger) Close ¶
func (cl *CachedLogger) Close() error
Close closes the underlying senders in the CachedLogger.
func (*CachedLogger) Send ¶
func (cl *CachedLogger) Send(lp *LoggingPayload) error
Send resolves a sender from the cached logger (either the error or output endpoint), and then sends the message from the data payload. This method ultimately is responsible for converting the payload to a message format.
type Command ¶
type Command struct { ID string `json:"id,omitempty"` Commands [][]string `json:"commands"` Process Create `json:"proc_opts,omitempty"` Remote *Remote `json:"remote_options,omitempty"` ContinueOnError bool `json:"continue_on_error,omitempty"` IgnoreError bool `json:"ignore_error,omitempty"` Priority level.Priority `json:"priority,omitempty"` RunBackground bool `json:"run_background,omitempty"` Sudo bool `json:"sudo,omitempty"` SudoUser string `json:"sudo_user,omitempty"` Prerequisite func() bool `json:"-"` PostHook CommandPostHook `json:"-"` PreHook CommandPreHook `json:"-"` }
Command represents jasper.Command options that are configurable by the user.
type CommandPostHook ¶
CommandPostHook describes a common function type to run after the command completes and processes its error, potentially overriding the output of the command.
func MergeAbortingPassthroughPostHooks ¶
func MergeAbortingPassthroughPostHooks(fns ...CommandPostHook) CommandPostHook
MergeAbortingPassthroughPostHooks produces a post hook that returns the error of the first post hook passed that does not return nil. If none of the passed functions return an error, the hook returns the original error.
func MergeAbortingPostHooks ¶
func MergeAbortingPostHooks(fns ...CommandPostHook) CommandPostHook
MergeAbortingPostHooks produces a post hook that returns the first error returned by one of it's argument functions, and returns nil if no function returns an error.
func MergePostHooks ¶
func MergePostHooks(fns ...CommandPostHook) CommandPostHook
MergePostHooks runs all post hooks, collecting the errors and merging them.
type CommandPreHook ¶
CommandPreHook describes a common function type to run before sub-commands in a command object and can modify the state of the command.
func MergePreHooks ¶
func MergePreHooks(fns ...CommandPreHook) CommandPreHook
MergePreHooks produces a single PreHook function that runs all defined prehooks.
func NewDefaultLoggingPreHook ¶
func NewDefaultLoggingPreHook(lp level.Priority) CommandPreHook
NewDefaultLoggingPreHook uses the global grip logger to log a debug message at the specified priority level.
func NewLoggingPreHook ¶
func NewLoggingPreHook(logger grip.Journaler, lp level.Priority) CommandPreHook
NewLoggingPreHook provides a logging message for debugging purposes that prints information from the creation options.
func NewLoggingPreHookFromSender ¶
func NewLoggingPreHookFromSender(sender send.Sender, lp level.Priority) CommandPreHook
NewLoggingPreHookFromSender produces a logging prehook that wraps a sender.
type Create ¶
type Create struct { Args []string `bson:"args" json:"args" yaml:"args"` Environment map[string]string `bson:"env,omitempty" json:"env,omitempty" yaml:"env,omitempty"` // OverrideEnviron overrides the default behavior so that the process // environment does not inherit the currently executing process's // environment. By default, the process will inherit the current process's // environment. This is ignored if Remote options are specified. OverrideEnviron bool `bson:"override_env,omitempty" json:"override_env,omitempty" yaml:"override_env,omitempty"` // Synchronized specifies whether the process should be thread-safe or not. // This is not guaranteed to be respected for managed processes. Synchronized bool `bson:"synchronized" json:"synchronized" yaml:"synchronized"` // Implementation specifies the local process implementation to use. This // is not guaranteed to be respected for managed processes. Implementation string `bson:"implementation,omitempty" json:"implementation,omitempty" yaml:"implementation,omitempty"` WorkingDirectory string `bson:"working_directory,omitempty" json:"working_directory,omitempty" yaml:"working_directory,omitempty"` Output Output `bson:"output" json:"output" yaml:"output"` // Remote specifies options for creating processes over SSH. Remote *Remote `bson:"remote,omitempty" json:"remote,omitempty" yaml:"remote,omitempty"` // TimeoutSecs takes precedence over Timeout. On remote interfaces, // TimeoutSecs should be set instead of Timeout. TimeoutSecs int `bson:"timeout_secs,omitempty" json:"timeout_secs,omitempty" yaml:"timeout_secs,omitempty"` Timeout time.Duration `bson:"timeout,omitempty" json:"-" yaml:"-"` Tags []string `bson:"tags,omitempty" json:"tags,omitempty" yaml:"tags,omitempty"` OnSuccess []*Create `bson:"on_success,omitempty" json:"on_success,omitempty" yaml:"on_success"` OnFailure []*Create `bson:"on_failure,omitempty" json:"on_failure,omitempty" yaml:"on_failure"` OnTimeout []*Create `bson:"on_timeout,omitempty" json:"on_timeout,omitempty" yaml:"on_timeout"` // StandardInputBytes takes precedence over StandardInput. On remote // interfaces, StandardInputBytes should be set instead of StandardInput. StandardInput io.Reader `bson:"-" json:"-" yaml:"-"` StandardInputBytes []byte `bson:"stdin_bytes" json:"stdin_bytes" yaml:"stdin_bytes"` // GroupLeader sets the child process as a group leader so its pgid is set to its pid. // This is a noop for remote executors and on non-unix systems. GroupLeader bool `bson:"group_leader" json:"group_leader" yaml:"group_leader"` // contains filtered or unexported fields }
Create contains options related to starting a process. This includes execution configuration, post-execution triggers, and output configuration. It is not safe for concurrent access.
func MakeCreation ¶
MakeCreation takes a command string and returns an equivalent Create struct that would spawn a process corresponding to the given command string.
func (*Create) AddEnvVar ¶
AddEnvVar adds an environment variable to the Create struct on which this method is called. If the Environment map is nil, this method will instantiate one.
func (*Create) Close ¶
Close will execute the closer functions assigned to the Create. This function is often called as a trigger at the end of a process' lifetime in Jasper.
func (*Create) Copy ¶
Copy returns a copy of the options for only the exported fields. Unexported fields are cleared.
func (*Create) Hash ¶
Hash returns the canonical hash implementation for the create options (and thus the process it will create.)
func (*Create) RegisterCloser ¶
RegisterCloser adds the closer function to the processes closer functions, which are called when the process finishes running.
func (*Create) Resolve ¶
func (opts *Create) Resolve(ctx context.Context) (exe executor.Executor, t time.Time, resolveErr error)
Resolve creates the command object according to the create options. It returns the resolved command and the deadline when the command will be terminated by timeout. If there is no deadline, it returns the zero time.
func (*Create) ResolveEnvironment ¶
ResolveEnvironment returns the (Create).Environment as a slice of environment variables in the form "key=value".
type DefaultLoggerOptions ¶
type DefaultLoggerOptions struct { Prefix string `json:"prefix" bson:"prefix"` Base BaseOptions `json:"base" bson:"base"` }
DefaultLoggerOptions encapsulates the options for creating a logger that logs to the native standard streams (i.e. stdout, stderr).
func (*DefaultLoggerOptions) Configure ¶
func (opts *DefaultLoggerOptions) Configure() (send.Sender, error)
Configure returns a send.Sender based on the default logging options.
func (*DefaultLoggerOptions) Type ¶
func (*DefaultLoggerOptions) Type() string
Type returns the log type for default loggers.
func (*DefaultLoggerOptions) Validate ¶
func (opts *DefaultLoggerOptions) Validate() error
Validate checks that a default prefix is specified and that the common base options are valid.
type Download ¶
type Download struct { URL string `json:"url"` Path string `json:"path"` ArchiveOpts Archive `json:"archive_opts"` }
Download represents the options to download a file to a given path and optionally extract its contents.
type FileLoggerOptions ¶
type FileLoggerOptions struct { Filename string `json:"filename" bson:"filename"` Base BaseOptions `json:"base" bson:"base"` }
FileLoggerOptions encapsulates the options for creating a file logger.
func (*FileLoggerOptions) Configure ¶
func (opts *FileLoggerOptions) Configure() (send.Sender, error)
Configure returns a send.Sender based on the file options.
func (*FileLoggerOptions) Type ¶
func (*FileLoggerOptions) Type() string
Type returns the log type for file loggers.
func (*FileLoggerOptions) Validate ¶
func (opts *FileLoggerOptions) Validate() error
Validate checks that the file name is given and that the common base options are valid.
type Filter ¶
type Filter string
Filter is type for classifying and grouping types of processes in filter operations, such as that found in List() on Managers.
const ( // Running is a filter for processes that have not yet completed and are // still running. Running Filter = "running" // Terminated is the opposite of the Running filter. Terminated Filter = "terminated" // All is a filter that is satisfied by any process. All Filter = "all" // Failed refers to processes that have terminated unsuccessfully. Failed Filter = "failed" // Successful refers to processes that have terminated successfully. Successful Filter = "successful" )
type InMemoryLoggerOptions ¶
type InMemoryLoggerOptions struct { InMemoryCap int `json:"in_memory_cap" bson:"in_memory_cap"` Base BaseOptions `json:"base" bson:"base"` }
InMemoryLoggerOptions encapsulates the options for creating an in-memory logger.
func (*InMemoryLoggerOptions) Configure ¶
func (opts *InMemoryLoggerOptions) Configure() (send.Sender, error)
Configure returns a send.Sender based on the in-memory logger options.
func (*InMemoryLoggerOptions) Type ¶
func (*InMemoryLoggerOptions) Type() string
Type returns the log type for in-memory loggers.
func (*InMemoryLoggerOptions) Validate ¶
func (opts *InMemoryLoggerOptions) Validate() error
Validate checks that the in-memory capacity is specified and that the common base options are valid.
type InheritedLoggerOptions ¶
type InheritedLoggerOptions struct {
Base BaseOptions `json:"base" bson:"base"`
}
InheritedLoggerOptions encapsulates the options for creating a logger inherited from the globally-configured grip logger.
func (*InheritedLoggerOptions) Configure ¶
func (opts *InheritedLoggerOptions) Configure() (send.Sender, error)
Configure returns a send.Sender based on the inherited logger options.
func (*InheritedLoggerOptions) Type ¶
func (*InheritedLoggerOptions) Type() string
Type returns the log type for inherited loggers.
type LogFormat ¶
type LogFormat string
LogFormat specifies a certain format for logging by Jasper. See the documentation for grip/send for more information on the various LogFormats.
const ( LogFormatPlain LogFormat = "plain" LogFormatDefault LogFormat = "default" LogFormatJSON LogFormat = "json" LogFormatInvalid LogFormat = "invalid" )
Constants representing formats for logging.
func (LogFormat) MakeFormatter ¶
func (f LogFormat) MakeFormatter() (send.MessageFormatter, error)
MakeFormatter creates a grip/send.MessageFormatter for the specified LogFormat on which it is called.
type LoggerConfig ¶
type LoggerConfig struct { Registry LoggerRegistry // contains filtered or unexported fields }
LoggerConfig represents the necessary information to construct a new grip send.Sender. The Registry is the authoritative source of LoggerProducers that it can use to create the send.Sender. LoggerConfig implements the JSON and BSON Marshaler and Unmarshaler interfaces.
func NewLoggerConfig ¶
func NewLoggerConfig(producerType string, format RawLoggerConfigFormat, config []byte) *LoggerConfig
NewLoggerConfig returns a LoggerConfig with the given info. This function expects a raw logger config as a byte slice. If this logger config is meant to be used in-memory, (*LoggerConfig).Set must be called before it can be used.
func (*LoggerConfig) MarshalBSON ¶
func (lc *LoggerConfig) MarshalBSON() ([]byte, error)
MarshalBSON resolves the LoggerProducer from this LoggerConfig, marshals it to BSON, and returns the logger configuration information necessary to reconstruct the LoggerConfig.
func (*LoggerConfig) MarshalJSON ¶
func (lc *LoggerConfig) MarshalJSON() ([]byte, error)
MarshalJSON resolves the LoggerProducer from this LoggerConfig, marshals it to JSON, and returns the logger configuration information necessary to reconstruct the LoggerConfig.
func (*LoggerConfig) Producer ¶
func (lc *LoggerConfig) Producer() LoggerProducer
Producer returns the underlying logger producer for this LoggerConfig, which may be nil.
func (*LoggerConfig) Resolve ¶
func (lc *LoggerConfig) Resolve() (send.Sender, error)
Resolve resolves the LoggerConfig and returns the resulting grip send.Sender.
func (*LoggerConfig) Set ¶
func (lc *LoggerConfig) Set(producer LoggerProducer) error
Set sets the logger producer and type for the LoggerConfig.
func (*LoggerConfig) UnmarshalBSON ¶
func (lc *LoggerConfig) UnmarshalBSON(b []byte) error
UnmarshalBSON unmarshals the logger configuration information necessary to reconstruct the LoggerConfig.
func (*LoggerConfig) UnmarshalJSON ¶
func (lc *LoggerConfig) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the logger configuration necessary to reconstruct the LoggerConfig.
type LoggerProducer ¶
LoggerProducer produces a Logger interface backed by a grip logger.
func NewBuildloggerV2LoggerProducer ¶
func NewBuildloggerV2LoggerProducer() LoggerProducer
NewBuildloggerV2LoggerProducer returns a LoggerProducer for creating Buildlogger v2 loggers.
func NewDefaultLoggerProducer ¶
func NewDefaultLoggerProducer() LoggerProducer
NewDefaultLoggerProducer returns a LoggerProducer backed by DefaultLoggerOptions.
func NewFileLoggerProducer ¶
func NewFileLoggerProducer() LoggerProducer
NewFileLoggerProducer returns a LoggerProducer backed by FileLoggerOptions.
func NewInMemoryLoggerProducer ¶
func NewInMemoryLoggerProducer() LoggerProducer
NewInMemoryLoggerProducer returns a LoggerProducer for creating in-memory loggers.
func NewInheritedLoggerProducer ¶
func NewInheritedLoggerProducer() LoggerProducer
NewInheritedLoggerProducer returns a LoggerProducer for creating inherited loggers.
func NewSplunkLoggerProducer ¶
func NewSplunkLoggerProducer() LoggerProducer
NewSplunkLoggerProducer returns a LoggerProducer for creating Splunk loggers.
type LoggerProducerFactory ¶
type LoggerProducerFactory func() LoggerProducer
LoggerProducerFactory creates a new instance of a LoggerProducer implementation.
type LoggerRegistry ¶
type LoggerRegistry interface { Register(LoggerProducerFactory) Check(string) bool Names() []string Resolve(string) (LoggerProducerFactory, bool) }
LoggerRegistry is an interface that stores reusable logger factories.
func GetGlobalLoggerRegistry ¶
func GetGlobalLoggerRegistry() LoggerRegistry
GetGlobalLoggerRegistry returns the global logger registry.
func NewBasicLoggerRegistry ¶
func NewBasicLoggerRegistry() LoggerRegistry
NewBasicLoggerRegistry returns a new LoggerRegistry implementation.
type LoggingPayload ¶
type LoggingPayload struct { LoggerID string `bson:"logger_id" json:"logger_id" yaml:"logger_id"` Data interface{} `bson:"data" json:"data" yaml:"data"` Priority level.Priority `bson:"priority" json:"priority" yaml:"priority"` IsMulti bool `bson:"multi,omitempty" json:"multi,omitempty" yaml:"multi,omitempty"` PreferSendToError bool `bson:"prefer_send_to_error,omitempty" json:"prefer_send_to_error,omitempty" yaml:"prefer_send_to_error,omitempty"` AddMetadata bool `bson:"add_metadata,omitempty" json:"add_metadata,omitempty" yaml:"add_metadata,omitempty"` Format LoggingPayloadFormat `bson:"payload_format,omitempty" json:"payload_format,omitempty" yaml:"payload_format,omitempty"` }
LoggingPayload captures the arguments to the SendMessages operation.
func (*LoggingPayload) Validate ¶
func (lp *LoggingPayload) Validate() error
Validate checks that the required fields are populated for the payload and the format is valid.
type LoggingPayloadFormat ¶
type LoggingPayloadFormat string
LoggingPayloadFormat is an set enumerated values describing the formating or encoding of the payload data.
type MongoDBDownload ¶
type MongoDBDownload struct { BuildOpts bond.BuildOptions `json:"build_opts"` Path string `json:"path"` Releases []string `json:"releases"` }
MongoDBDownload represents the options to download MongoDB on a target platform.
func (MongoDBDownload) Validate ¶
func (opts MongoDBDownload) Validate() error
Validate checks for valid MongoDB download options.
type Output ¶
type Output struct { Output io.Writer `bson:"-" json:"-" yaml:"-"` Error io.Writer `bson:"-" json:"-" yaml:"-"` SuppressOutput bool `bson:"suppress_output" json:"suppress_output" yaml:"suppress_output"` SuppressError bool `bson:"suppress_error" json:"suppress_error" yaml:"suppress_error"` SendOutputToError bool `bson:"redirect_output_to_error" json:"redirect_output_to_error" yaml:"redirect_output_to_error"` SendErrorToOutput bool `bson:"redirect_error_to_output" json:"redirect_error_to_output" yaml:"redirect_error_to_output"` // Loggers are self-contained and specific to the process they are attached // to. They are closed and cleaned up when the process exits. If this // behavior is not desired, use Output instead of Loggers. Loggers []*LoggerConfig `bson:"loggers" json:"loggers,omitempty" yaml:"loggers"` // contains filtered or unexported fields }
Output provides a common way to define and represent the output behavior of a evergreen/subprocess.Command operation.
func (*Output) CachedLogger ¶
func (o *Output) CachedLogger(id string) *CachedLogger
CachedLogger returns a cached logger with the given ID with its error and output derived from Output.
func (*Output) Copy ¶
Copy returns a copy of the options for only the exported fields. Unexported fields are cleared.
func (*Output) GetError ¶
GetError returns an io.Writer that can be used for standard error, depending on the output configuration.
type RawLoggerConfig ¶
type RawLoggerConfig []byte
RawLoggerConfig wraps byte slice and implements the json and bson Marshaler and Unmarshaler interfaces.
func (RawLoggerConfig) MarshalBSON ¶
func (lc RawLoggerConfig) MarshalBSON() ([]byte, error)
MarshalBSON returns the unwrapped byte slice from the RawLoggerConfig.
func (*RawLoggerConfig) MarshalJSON ¶
func (lc *RawLoggerConfig) MarshalJSON() ([]byte, error)
MarshalJSON returns the unwrapped byte slice from a RawLoggerConfig.
func (*RawLoggerConfig) UnmarshalBSON ¶
func (lc *RawLoggerConfig) UnmarshalBSON(b []byte) error
UnmarshalBSON sets the unwrapped byte slice to the given BSON byte slice.
func (*RawLoggerConfig) UnmarshalJSON ¶
func (lc *RawLoggerConfig) UnmarshalJSON(b []byte) error
UnmarshalJSON sets the wrapped byte slice to the given byte slice.
type RawLoggerConfigFormat ¶
type RawLoggerConfigFormat string
RawLoggerConfigFormat describes the format of the raw logger configuration.
const ( RawLoggerConfigFormatBSON RawLoggerConfigFormat = "BSON" RawLoggerConfigFormatJSON RawLoggerConfigFormat = "JSON" RawLoggerConfigFormatInvalid RawLoggerConfigFormat = "invalid" )
Constants representing valid formats for RawLoggerConfig.
func (RawLoggerConfigFormat) Unmarshal ¶
func (f RawLoggerConfigFormat) Unmarshal(data []byte, out interface{}) error
Unmarshal unmarshals the given data using the corresponding unmarshaler for the RawLoggerConfigFormat type.
func (RawLoggerConfigFormat) Validate ¶
func (f RawLoggerConfigFormat) Validate() error
Validate ensures that RawLoggerConfigFormat is valid.
type Remote ¶
type Remote struct { Host string `bson:"host" json:"host"` User string `bson:"user" json:"user"` // Additional args to the SSH binary. Args []string `bson:"args,omitempty" json:"args,omitempty"` }
Remote represents options to SSH into a remote machine.
type RemoteConfig ¶
type RemoteConfig struct { }
RemoteConfig represents the arguments to connect to a remote host.
type SafeSender ¶
SafeSender wraps a grip send.Sender and its base sender, ensuring that the base sender is closed correctly.
func (*SafeSender) Close ¶
func (s *SafeSender) Close() error
Close closes all underlying send.Senders to provide a stronger guarantee on closing its underlying send.Senders to free the resources. This resolves an issue in some send.Sender implementations (particularly the buffered sender) where send.Senders that wrap other senders are not guaranteed to close the send.Sender that they wrap, which can be a resource leak.
func (*SafeSender) GetSender ¶
func (s *SafeSender) GetSender() send.Sender
GetSender returns the underlying base grip send.Sender.
type SplunkLoggerOptions ¶
type SplunkLoggerOptions struct { Splunk send.SplunkConnectionInfo `json:"splunk" bson:"splunk"` Base BaseOptions `json:"base" bson:"base"` }
SplunkLoggerOptions encapsulates the options for creating a Splunk logger.
func (*SplunkLoggerOptions) Configure ¶
func (opts *SplunkLoggerOptions) Configure() (send.Sender, error)
Configure returns a send.Sender based on the Splunk options.
func (*SplunkLoggerOptions) Type ¶
func (*SplunkLoggerOptions) Type() string
Type returns the log type for Splunk.
func (*SplunkLoggerOptions) Validate ¶
func (opts *SplunkLoggerOptions) Validate() error
Validate checks that the Splunk options are populated and that the common base options are valid.
type WriteFile ¶
type WriteFile struct { Path string `json:"path" bson:"path"` // File content can come from either Content or Reader, but not both. // Content should only be used if the entire file's contents can be held in // memory. Content []byte `json:"content" bson:"content"` Reader io.Reader `json:"-" bson:"-"` Append bool `json:"append" bson:"append"` Perm os.FileMode `json:"perm" bson:"perm"` }
WriteFile represents the options necessary to write to a file.
func (*WriteFile) ContentReader ¶
ContentReader returns the contents to be written to the file as an io.Reader.
func (*WriteFile) DoWrite ¶
DoWrite writes the data to the given path, creating the directory hierarchy as needed and the file if it does not exist yet.
func (*WriteFile) SetPerm ¶
SetPerm sets the file permissions on the file. This should be called after DoWrite. If no file exists at (WriteFile).Path, it will error.
func (*WriteFile) Validate ¶
Validate ensures that all the parameters to write to a file are valid and sets default permissions if necessary.
func (*WriteFile) WriteBufferedContent ¶
WriteBufferedContent writes the content to a file by repeatedly calling doWrite with a buffered portion of the content. doWrite processes the WriteFile containing the next content to write to the file.