{"modulePath":"github.com/cloudzero/cloudzero-agent","version":"v1.3.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package logging\n\nPackage logging contains utilities for logging.\n\n## Constants\n\n```go\nconst (\n\tFieldsKey = \"fields.\"\n)\n```\n\n```go\nconst (\n\tLogSequence = \"log_sequence\"\n)\n```\n\n```go\nconst (\n\tOpField = \"op\"\n)\n```\n\n## Functions\n\n```go\nfunc LogLevel(name string) logrus.Level\n```\n\n```go\nfunc LogToFile(file string) *logrus.Logger\n```\n\n```go\nfunc NewLogger() *logrus.Logger\n```\n\n```go\nfunc SetUpLogging(level string, format LogFormat)\n```\n\n## Types\n\n```go\ntype FieldMap map[fieldKey]string\n```\nFieldMap allows customization of the key names for default fields.\n\n```go\ntype LogFormat string\n```\n\n```go\nconst (\n\tLogFormatJSON         LogFormat = \"json\"\n\tLogFormatText         LogFormat = \"text\"\n\tLogFormatTextColorful LogFormat = \"text:colorful\"\n\n\tDefaultLogLevel = \"info\"\n)\n```\n\n```go\ntype PlainTextFormatter struct {\n\t// Force quoting of all values\n\tForceQuote bool\n\n\t// DisableQuote disables quoting for all values.\n\t// DisableQuote will have a lower priority than ForceQuote.\n\t// If both of them are set to true, quote will be forced on all values.\n\tDisableQuote bool\n\n\t// Disable timestamp logging. useful when output is redirected to logging\n\t// system that already adds timestamps.\n\tDisableTimestamp bool\n\n\t// Enable logging the full timestamp when a TTY is attached instead of just\n\t// the time passed since beginning of execution.\n\tFullTimestamp bool\n\n\t// TimestampFormat to use for display when a full timestamp is printed.\n\t// The format to use is the same than for time.Format or time.Parse from the standard\n\t// library.\n\t// The standard Library already provides a set of predefined format.\n\tTimestampFormat string\n\n\t// The fields are sorted by default for a consistent output. For applications\n\t// that log extremely frequently and don't use the JSON formatter this may not\n\t// be desired.\n\tDisableSorting bool\n\n\t// The keys sorting function, when uninitialized it uses sort.Strings.\n\tSortingFunc func([]string)\n\n\t// Disables the truncation of the level text to 4 characters.\n\tDisableLevelTruncation bool\n\n\t// PadLevelText Adds padding the level text so that all the levels output at the same length\n\t// PadLevelText is a superset of the DisableLevelTruncation option\n\tPadLevelText bool\n\n\t// QuoteEmptyFields will wrap empty fields in quotes if true\n\tQuoteEmptyFields bool\n\n\t// FieldMap allows users to customize the names of keys for default fields.\n\t// As an example:\n\t// formatter := \u0026PlainTextFormatter{\n\t//     FieldMap: FieldMap{\n\t//         FieldKeyTime:  \"@timestamp\",\n\t//         FieldKeyLevel: \"@level\",\n\t//         FieldKeyMsg:   \"@message\"}}\n\tFieldMap FieldMap\n\n\t// CallerPrettyfier can be set by the user to modify the content\n\t// of the function and file keys in the data when ReportCaller is\n\t// activated. If any of the returned value is the empty string the\n\t// corresponding key will be removed from fields.\n\tCallerPrettyfier func(*runtime.Frame) (function string, file string)\n\t// contains filtered or unexported fields\n}\n```\nPlainTextFormatter formats logs into text\n\n```go\nfunc (f *PlainTextFormatter) Format(entry *logrus.Entry) ([]byte, error)\n```\nFormat renders a single log entry\n\n```go\ntype SequenceLogger struct {\n\t// contains filtered or unexported fields\n}\n```\nSequenceLogger adds a monotonically increasing number to each log entry, to allow ordering when time to the millisecond is identical (a limitation of AWS CloudWatch's @timestamp field). In CloudWatch query, can add a secondary sort key like so:\n\n\t| sort @timestamp desc, log_sequence desc\n\n```go\nfunc NewSequenceLogger(wrap logrus.Formatter) *SequenceLogger\n```\n\n```go\nfunc (f *SequenceLogger) Format(entry *logrus.Entry) ([]byte, error)\n```\n\n","path":"github.com/cloudzero/cloudzero-agent/app/logging/validator","name":"logging","synopsis":"Package logging contains utilities for logging.","isRedistributable":true}
