Documentation ¶
Overview ¶
Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at
http://aws.amazon.com/apache2.0/
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- type NanoTime
- type PluginOutputTrace
- func (po *PluginOutputTrace) AppendDebug(log log.T, message string)
- func (po *PluginOutputTrace) AppendDebugf(log log.T, format string, params ...interface{})
- func (po *PluginOutputTrace) AppendError(log log.T, message string)
- func (po *PluginOutputTrace) AppendErrorf(log log.T, format string, params ...interface{})
- func (po *PluginOutputTrace) AppendInfo(log log.T, message string)
- func (po *PluginOutputTrace) AppendInfof(log log.T, format string, params ...interface{})
- func (po *PluginOutputTrace) GetExitCode() int
- func (po *PluginOutputTrace) GetStatus() contracts.ResultStatus
- func (po *PluginOutputTrace) GetStderr() string
- func (po *PluginOutputTrace) GetStdout() string
- func (out *PluginOutputTrace) MarkAsCancelled()
- func (po *PluginOutputTrace) MarkAsFailed(log log.T, err error)
- func (out *PluginOutputTrace) MarkAsInProgress()
- func (out *PluginOutputTrace) MarkAsShutdown()
- func (out *PluginOutputTrace) MarkAsSucceeded()
- func (out *PluginOutputTrace) MarkAsSuccessWithReboot()
- func (po *PluginOutputTrace) SetExitCode(exitCode int)
- func (po *PluginOutputTrace) SetStatus(status contracts.ResultStatus)
- func (out *PluginOutputTrace) String() string
- type TimeImpl
- type Trace
- func (t *Trace) AppendDebug(message string) *Trace
- func (t *Trace) AppendDebugf(format string, params ...interface{}) *Trace
- func (t *Trace) AppendError(message string) *Trace
- func (t *Trace) AppendErrorf(format string, params ...interface{}) *Trace
- func (t *Trace) AppendInfo(message string) *Trace
- func (t *Trace) AppendInfof(format string, params ...interface{}) *Trace
- func (t *Trace) AppendWithSubtraces(message string) *Trace
- func (t *Trace) End() error
- func (t *Trace) EndWithError(err *error) *Trace
- func (t *Trace) WithError(err error) *Trace
- func (t *Trace) WithExitcode(exitcode int64) *Trace
- type Tracer
- type TracerImpl
- func (t *TracerImpl) AddTrace(trace *Trace)
- func (t *TracerImpl) BeginSection(message string) *Trace
- func (t *TracerImpl) CurrentTrace() *Trace
- func (t *TracerImpl) EndSection(trace *Trace) error
- func (t *TracerImpl) PrependTraces(traces []*Trace)
- func (t *TracerImpl) ToPluginOutput() iohandler.IOHandler
- func (t *TracerImpl) Traces() []*Trace
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NanoTime ¶
type NanoTime interface {
NowUnixNano() int64
}
NanoTime is helper interface for mocking time
type PluginOutputTrace ¶
type PluginOutputTrace struct { Tracer Tracer // contains filtered or unexported fields }
func (*PluginOutputTrace) AppendDebug ¶
func (po *PluginOutputTrace) AppendDebug(log log.T, message string)
func (*PluginOutputTrace) AppendDebugf ¶
func (po *PluginOutputTrace) AppendDebugf(log log.T, format string, params ...interface{})
func (*PluginOutputTrace) AppendError ¶
func (po *PluginOutputTrace) AppendError(log log.T, message string)
func (*PluginOutputTrace) AppendErrorf ¶
func (po *PluginOutputTrace) AppendErrorf(log log.T, format string, params ...interface{})
func (*PluginOutputTrace) AppendInfo ¶
func (po *PluginOutputTrace) AppendInfo(log log.T, message string)
func (*PluginOutputTrace) AppendInfof ¶
func (po *PluginOutputTrace) AppendInfof(log log.T, format string, params ...interface{})
func (*PluginOutputTrace) GetExitCode ¶
func (po *PluginOutputTrace) GetExitCode() int
func (*PluginOutputTrace) GetStatus ¶
func (po *PluginOutputTrace) GetStatus() contracts.ResultStatus
func (*PluginOutputTrace) GetStderr ¶
func (po *PluginOutputTrace) GetStderr() string
func (*PluginOutputTrace) GetStdout ¶
func (po *PluginOutputTrace) GetStdout() string
func (*PluginOutputTrace) MarkAsCancelled ¶
func (out *PluginOutputTrace) MarkAsCancelled()
func (*PluginOutputTrace) MarkAsFailed ¶
func (po *PluginOutputTrace) MarkAsFailed(log log.T, err error)
func (*PluginOutputTrace) MarkAsInProgress ¶
func (out *PluginOutputTrace) MarkAsInProgress()
func (*PluginOutputTrace) MarkAsShutdown ¶
func (out *PluginOutputTrace) MarkAsShutdown()
func (*PluginOutputTrace) MarkAsSucceeded ¶
func (out *PluginOutputTrace) MarkAsSucceeded()
func (*PluginOutputTrace) MarkAsSuccessWithReboot ¶
func (out *PluginOutputTrace) MarkAsSuccessWithReboot()
func (*PluginOutputTrace) SetExitCode ¶
func (po *PluginOutputTrace) SetExitCode(exitCode int)
func (*PluginOutputTrace) SetStatus ¶
func (po *PluginOutputTrace) SetStatus(status contracts.ResultStatus)
func (*PluginOutputTrace) String ¶
func (out *PluginOutputTrace) String() string
type Trace ¶
type Trace struct { Tracer Tracer `json:"-"` Logger log.T `json:"-"` Operation string // results Exitcode int64 Error string `json:",omitempty"` // timing Start int64 Stop int64 `json:",omitempty"` // output InfoOut bytes.Buffer `json:"-"` ErrorOut bytes.Buffer `json:"-"` }
func (*Trace) AppendDebug ¶
AppendDebug adds debug info to the trace
func (*Trace) AppendDebugf ¶
AppendDebugf adds debug info to the trace
func (*Trace) AppendError ¶
AppendError adds errors to PluginOutput StandardErr.
func (*Trace) AppendErrorf ¶
AppendErrorf adds errors to PluginOutput StandardErr with formatting parameters.
func (*Trace) AppendInfo ¶
AppendInfo adds info to PluginOutput StandardOut.
func (*Trace) AppendInfof ¶
AppendInfof adds info to PluginOutput StandardOut with formatting parameters.
func (*Trace) AppendWithSubtraces ¶
func (*Trace) EndWithError ¶
EndWithError just combines two commonly used methods to be able to use it in combination with defer
func asdf(tracer Tracer) { var err error defer tracer.BeginSection("testtracemsg").EndWithError(err) ... }
func (*Trace) WithExitcode ¶
WithExitcode sets the exitcode of the trace
type Tracer ¶
type Tracer interface { BeginSection(message string) *Trace EndSection(trace *Trace) error AddTrace(trace *Trace) Traces() []*Trace PrependTraces([]*Trace) CurrentTrace() *Trace ToPluginOutput() iohandler.IOHandler }
Tracer is used for collecting traces during a package installation
type TracerImpl ¶
type TracerImpl struct {
// contains filtered or unexported fields
}
TracerImpl implements the Tracer interface for collecting traces
func (*TracerImpl) AddTrace ¶
func (t *TracerImpl) AddTrace(trace *Trace)
AddTrace takes a one time trace without tracking a duration
func (*TracerImpl) BeginSection ¶
func (t *TracerImpl) BeginSection(message string) *Trace
BeginSection will create a new trace and registers with the tracer
func (*TracerImpl) CurrentTrace ¶
func (t *TracerImpl) CurrentTrace() *Trace
CurrentTrace will return the last unclosed trace If no trace is open it will return nil
func (*TracerImpl) EndSection ¶
func (t *TracerImpl) EndSection(trace *Trace) error
EndSection will close the trace provided in the parameter. If the provided trace is not the upper one on the stack it will close all traces in between.
func (*TracerImpl) PrependTraces ¶
func (t *TracerImpl) PrependTraces(traces []*Trace)
PrependTraces takes existing traces and add them at the beginning while also setting their Tracer and Logger
func (*TracerImpl) ToPluginOutput ¶
func (t *TracerImpl) ToPluginOutput() iohandler.IOHandler
ToPluginOutput will convert info and error output into a IOHandler struct It will sort the output by trace end time
func (*TracerImpl) Traces ¶
func (t *TracerImpl) Traces() []*Trace
Traces will return all closed traces