logz

package
v17.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2024 License: MIT Imports: 11 Imported by: 0

README

The logz package

The logz package should be used to re-use existing log fields (zap.Field) and helpers. New log fields can be added in case they don't drag in any new dependency. In case the log field requires a new dependency, you should define the log field name in fields.go and define the zap.Field helper in the module where it's used.

Log field names

Log field names must be in snake_case.

Documentation

Index

Constants

View Source
const (
	AgentConfig = "agent_config"
	ApplyEvent  = "apply_event"
)

Variables

This section is empty.

Functions

func AgentID

func AgentID(agentID int64) zap.Field

func AgentVersion added in v17.1.0

func AgentVersion(agentVersion string) zap.Field

func CommitID

func CommitID(commitID string) zap.Field

func DurationInMilliseconds

func DurationInMilliseconds(duration time.Duration) zap.Field

func Error

func Error(err error) zap.Field

func FullReconciliationInterval added in v17.1.0

func FullReconciliationInterval(interval time.Duration) zap.Field

func GRPCMethod

func GRPCMethod(method string) zap.Field

func GRPCService

func GRPCService(service string) zap.Field

func GatewayURL added in v17.1.0

func GatewayURL(gatewayURL string) zap.Field

func GitRepositoryURL

func GitRepositoryURL(url string) zap.Field

func InventoryName

func InventoryName(name string) zap.Field

func InventoryNamespace

func InventoryNamespace(namespace string) zap.Field

func IsWebSocket

func IsWebSocket(isWebSocket bool) zap.Field

func K8sGroup

func K8sGroup(groupName string) zap.Field

func K8sObjectName

func K8sObjectName(name string) zap.Field

func K8sResource

func K8sResource(resourceName string) zap.Field

func LevelFromString

func LevelFromString(levelStr string) (zapcore.Level, error)

func ModuleName

func ModuleName(name string) zap.Field

GitLab-kas or agentk module name.

func NamespacedName

func NamespacedName(n string) zap.Field

func NetAddress

func NetAddress(listenAddress string) zap.Field

func NetAddressFromAddr

func NetAddressFromAddr(addr net.Addr) zap.Field

func NetNetwork

func NetNetwork(listenNetwork string) zap.Field

func NetNetworkFromAddr

func NetNetworkFromAddr(addr net.Addr) zap.Field

func NewProductionEncoderConfig

func NewProductionEncoderConfig() zapcore.EncoderConfig

func NoSync

func NoSync(w io.Writer) zapcore.WriteSyncer

NoSync can be used to wrap a io.Writer that implements zapcore.WriteSyncer but does not actually support the Sync() operation. An example is os.Stderr that returns "sync /dev/stderr: inappropriate ioctl for device" on sync attempt.

func ObjectKey

func ObjectKey(obj interface{}) zap.Field

func PartialReconciliationInterval added in v17.1.0

func PartialReconciliationInterval(interval time.Duration) zap.Field

func PayloadSizeInBytes

func PayloadSizeInBytes(size int) zap.Field

func PodName

func PodName(podName string) zap.Field

func PodNamespace added in v17.1.0

func PodNamespace(podNamespace string) zap.Field

func PodStatus

func PodStatus(podStatus string) zap.Field

func PoolConnectionURL

func PoolConnectionURL(poolConnURL string) zap.Field

func ProjectID

func ProjectID(projectID string) zap.Field

ProjectID is the human-readable GitLab project path (e.g. gitlab-org/gitlab).

func ProjectsToReconcile

func ProjectsToReconcile(p []string) zap.Field

func ProtoJSONValue

func ProtoJSONValue(key string, value proto.Message) zap.Field

func RedisKey

func RedisKey(key []byte) zap.Field

Use for any keys in Redis.

func RemovedHashKeys

func RemovedHashKeys(n int) zap.Field

func RequestID

func RequestID(requestID string) zap.Field

func StatusCode

func StatusCode(code int32) zap.Field

func TargetNamespace

func TargetNamespace(namespace string) zap.Field

func ToZapField added in v17.1.0

func ToZapField(field fieldz.Field) zap.Field

func ToZapFields added in v17.1.0

func ToZapFields(fields []fieldz.Field, extraZapFields ...zap.Field) []zap.Field

ToZapFields converts fieldz.Field to zap.Field This function is useful to easily log all fieldz.Field. The fieldz.AgentIDFieldName is ignored because our loggers are already equipped with agent ids and we do not want to duplicate the key in the log message.

func TokenLimit

func TokenLimit(limit uint64) zap.Field

Use for any integer counters.

func TraceID

func TraceID(traceID trace.TraceID) zap.Field

func TraceIDFromContext

func TraceIDFromContext(ctx context.Context) zap.Field

func TunnelsByAgent

func TunnelsByAgent(numTunnels int) zap.Field

func U64Count

func U64Count(count uint64) zap.Field

Use for any integer counters.

func URL

func URL(url string) zap.Field

func URLPath

func URLPath(url string) zap.Field

func URLPathPrefix

func URLPathPrefix(urlPrefix string) zap.Field

func VulnerabilitiesCount

func VulnerabilitiesCount(n int) zap.Field

func WorkspaceDataCount

func WorkspaceDataCount(count int) zap.Field

func WorkspaceName

func WorkspaceName(name string) zap.Field

func WorkspaceNamespace

func WorkspaceNamespace(namespace string) zap.Field

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL