Documentation
¶
Index ¶
- Constants
- func BoolPtrValToString(p *bool) string
- func EnsureDiagnosticsLogsFolder() (string, error)
- func FriendlyErrorString(err error) string
- func FriendlyMetav1Timestamp(ts metav1.MicroTime) string
- func FriendlyString(s string) string
- func FriendlyStringMap(m map[string]string) string
- func FriendlyStringSlice(s []string) string
- func FriendlyTimestamp(ts time.Time) string
- func GetDiagnosticsLogFolder() string
- func GetDiagnosticsLogLevel() (zapcore.Level, error)
- func GetResourceLogPath(resourceId string) string
- func GetVerbosityArg(fs *pflag.FlagSet) string
- func IntPtrValToString[T int32 | int64, PT *T](p PT) string
- func ProcessMomentHash(flavor MomentHashFlavor) string
- func ReleaseAllResourceLogs()
- func ReleaseResourceLog(resourceId string)
- func SessionId() string
- func StringToLevel(value string, defaultLevel zapcore.Level) (zapcore.Level, error)
- func WithSessionId(cmd *exec.Cmd)
- type LevelFlagValue
- type Logger
- type MomentHashFlavor
Constants ¶
View Source
const ( DCP_DIAGNOSTICS_LOG_FOLDER = "DCP_DIAGNOSTICS_LOG_FOLDER" // Folder to write diagnostics logs to (defaults to a temp folder) DCP_DIAGNOSTICS_LOG_LEVEL = "DCP_DIAGNOSTICS_LOG_LEVEL" // Log level to include in diagnostics logs (defaults to none) DCP_LOG_SOCKET = "DCP_LOG_SOCKET" // Unix socket to write console logs to instead of stderr DCP_LOG_FILE_NAME_SUFFIX = "DCP_LOG_FILE_NAME_SUFFIX" // Suffix to append to the log file name (defaults to process ID) DCP_LOG_SESSION_ID = "DCP_LOG_SESSION_ID" // Session ID to include in log names DCP_EPOCH = 1665705600 // DCP epoch is the unix timestamp at the start of the day UTC time of the first commit to the DCP repo (2022-10-14T00:00:00.000Z) // The timestamp format used in logs (ISO8601) LogTimestampFormat = "2006-01-02T15:04:05.000Z0700" MacOsProcErrorLogFilter = "Could not get process start time, could not read \"/proc\": stat /proc: no such file or directory" )
View Source
const ( // This values acts as a special key for any logger that has a resource sink enabled. If the first argument to WithValues is this key, the second argument // will be treated as a resource log stream ID. In this case neither of the first two arguments will be included in the final log entries, but the resource // sink will track the resource ID value and use it to route a copy of log entries to a separate log file named based on the resource ID (i.e. resource-<resource_id>.log). // This log file will contain only the log entries partaining to that specific resource ID, allowing system logs pertaining to a given resource to be retrieved in isolation. RESOURCE_LOG_STREAM_ID = "resource_log_stream_id" )
Variables ¶
This section is empty.
Functions ¶
func BoolPtrValToString ¶
func EnsureDiagnosticsLogsFolder ¶
Returns the folder to write diagnostics logs and perf traces to.
func FriendlyErrorString ¶
func FriendlyMetav1Timestamp ¶
func FriendlyString ¶
func FriendlyStringMap ¶
func FriendlyStringSlice ¶
func FriendlyTimestamp ¶
func GetDiagnosticsLogFolder ¶
func GetDiagnosticsLogFolder() string
Returns the folder for diagnostics logs (and perf traces).
func GetDiagnosticsLogLevel ¶
func GetResourceLogPath ¶
func GetVerbosityArg ¶
func IntPtrValToString ¶
func ProcessMomentHash ¶
func ProcessMomentHash(flavor MomentHashFlavor) string
Computes a reasonably-unique, not-too-long value that represents "this moment in time, from the perspective of the current process". It is a hash of current timestamp and current process ID.
func ReleaseAllResourceLogs ¶
func ReleaseAllResourceLogs()
func ReleaseResourceLog ¶
func ReleaseResourceLog(resourceId string)
func StringToLevel ¶
func WithSessionId ¶
Types ¶
type LevelFlagValue ¶
type LevelFlagValue struct {
// contains filtered or unexported fields
}
func GetLevelFlagValue ¶
func GetLevelFlagValue(fs *pflag.FlagSet) (*LevelFlagValue, bool)
func NewLevelFlagValue ¶
func NewLevelFlagValue(onLevelAvailable func(zapcore.Level)) LevelFlagValue
func (*LevelFlagValue) Set ¶
func (lfv *LevelFlagValue) Set(flagValue string) error
func (*LevelFlagValue) String ¶
func (lfv *LevelFlagValue) String() string
func (*LevelFlagValue) Type ¶
func (_ *LevelFlagValue) Type() string
type Logger ¶
func (*Logger) AddLevelFlag ¶
Add verbosity flag to enable setting stdout log levels
func (*Logger) WithFilterSink ¶
func (*Logger) WithResourceSink ¶
type MomentHashFlavor ¶
type MomentHashFlavor int
const ( PlainHash MomentHashFlavor = iota TimeSortableHash )
Click to show internal directories.
Click to hide internal directories.