Documentation ¶
Overview ¶
Copyright 2018 the Velero contributors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.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.
Copyright 2018 the Velero contributors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.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 ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultHooks ¶ added in v0.9.0
DefaultHooks returns a slice of the default logrus hooks to be used by a logger.
Types ¶
type ErrorLocationHook ¶
type ErrorLocationHook struct{}
ErrorLocationHook is a logrus hook that attaches error location information to log entries if an error is being logged and it has stack-trace information (i.e. if it originates from or is wrapped by github.com/pkg/errors, or if it implements the errorLocationer interface, like errors returned from plugins typically do).
func (*ErrorLocationHook) Levels ¶
func (h *ErrorLocationHook) Levels() []logrus.Level
type Format ¶ added in v1.1.0
type Format string
Format is a string representation of the desired output format for logs
type FormatFlag ¶ added in v1.1.0
FormatFlag is a command-line flag for setting the logrus log format.
func NewFormatFlag ¶ added in v1.1.0
func NewFormatFlag() *FormatFlag
NewFormatFlag constructs a new log level flag.
func (*FormatFlag) Parse ¶ added in v1.1.0
func (f *FormatFlag) Parse() Format
Parse returns the flag's value as a Format.
type HcLogLevelHook ¶ added in v0.6.0
type HcLogLevelHook struct{}
HcLogLevelHook adds an hclog-compatible field ("@level") containing the log level. Note that if you use this, you SHOULD NOT use logrus.JSONFormatter's FieldMap to set the level key to "@level" because that will result in the hclog-compatible info written here being overwritten.
func (*HcLogLevelHook) Fire ¶ added in v0.6.0
func (h *HcLogLevelHook) Fire(entry *logrus.Entry) error
func (*HcLogLevelHook) Levels ¶ added in v0.6.0
func (h *HcLogLevelHook) Levels() []logrus.Level
type LevelFlag ¶ added in v0.9.0
LevelFlag is a command-line flag for setting the logrus log level.
func LogLevelFlag ¶ added in v0.9.0
LogLevelFlag constructs a new log level flag.
type LocationInfo ¶ added in v1.0.0
LocationInfo specifies the location of a line of code.
func GetFrameLocationInfo ¶ added in v1.0.0
func GetFrameLocationInfo(frame errors.Frame) LocationInfo
GetFrameLocationInfo returns the location of a frame.
type LogCounterHook ¶ added in v1.0.0
type LogCounterHook struct {
// contains filtered or unexported fields
}
LogCounterHook is a logrus hook that counts the number of log statements that have been written at each logrus level.
func NewLogCounterHook ¶ added in v1.0.0
func NewLogCounterHook() *LogCounterHook
NewLogCounterHook returns a pointer to an initialized LogCounterHook.
func (*LogCounterHook) Fire ¶ added in v1.0.0
func (h *LogCounterHook) Fire(entry *logrus.Entry) error
Fire executes the hook's logic.
func (*LogCounterHook) GetCount ¶ added in v1.0.0
func (h *LogCounterHook) GetCount(level logrus.Level) int
GetCount returns the number of log statements that have been written at the specific level provided.
func (*LogCounterHook) Levels ¶ added in v1.0.0
func (h *LogCounterHook) Levels() []logrus.Level
Levels returns the logrus levels that the hook should be fired for.
type LogLocationHook ¶
type LogLocationHook struct {
// contains filtered or unexported fields
}
LogLocationHook is a logrus hook that attaches location information to log entries, i.e. the file and line number of the logrus log call. This hook is designed for use in both the Velero server and Velero plugin implementations. When triggered within a plugin, a marker field will be set on the log entry indicating that the location came from a plugin. The Velero server instance will not overwrite location information if it sees this marker.
func (*LogLocationHook) Levels ¶
func (h *LogLocationHook) Levels() []logrus.Level
func (*LogLocationHook) WithLoggerName ¶ added in v0.6.0
func (h *LogLocationHook) WithLoggerName(name string) *LogLocationHook
WithLoggerName gives the hook a name to use when setting the marker field on a log entry indicating the location has been recorded by a plugin. This should only be used when setting up a hook for a logger used in a plugin.