Documentation
¶
Overview ¶
Copyright 2021 The Codefresh Authors.
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 2021 The Codefresh Authors.
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 ¶
- func GetLogrusEntry(l Logger) (*logrus.Entry, error)
- func SetDefault(logger Logger)
- func WithLogger(ctx context.Context, logger Logger) context.Context
- type Fields
- type Logger
- type LogrusConfig
- type LogrusFormatter
- type NopLogger
- func (NopLogger) AddPFlags(*cobra.Command)
- func (NopLogger) Debug(...interface{})
- func (NopLogger) Debugf(string, ...interface{})
- func (NopLogger) Error(...interface{})
- func (NopLogger) Errorf(string, ...interface{})
- func (NopLogger) Fatal(...interface{})
- func (NopLogger) Fatalf(string, ...interface{})
- func (NopLogger) Info(...interface{})
- func (NopLogger) Infof(string, ...interface{})
- func (NopLogger) Printf(string, ...interface{})
- func (NopLogger) Warn(...interface{})
- func (NopLogger) Warnf(string, ...interface{})
- func (l NopLogger) WithError(error) Logger
- func (l NopLogger) WithField(string, interface{}) Logger
- func (l NopLogger) WithFields(Fields) Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetDefault ¶
func SetDefault(logger Logger)
Types ¶
type Logger ¶
type Logger interface {
Printf(string, ...interface{})
Debug(...interface{})
Info(...interface{})
Warn(...interface{})
Fatal(...interface{})
Error(...interface{})
Debugf(string, ...interface{})
Infof(string, ...interface{})
Warnf(string, ...interface{})
Fatalf(string, ...interface{})
Errorf(string, ...interface{})
WithField(string, interface{}) Logger
WithFields(Fields) Logger
WithError(error) Logger
// AddPFlags adds persistent logger flags to cmd
AddPFlags(*cobra.Command)
}
func FromLogrus ¶
func FromLogrus(l *logrus.Entry, c *LogrusConfig) Logger
type LogrusConfig ¶
type LogrusConfig struct {
Level string
Format LogrusFormatter
}
type LogrusFormatter ¶
type LogrusFormatter string
const ( FormatterText LogrusFormatter = defaultFormatter FormatterJSON LogrusFormatter = "json" )