log

package
v0.0.0-...-2b67f9f Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package log is responsible for settings around logging output from customer functions to be sent to Datadog (logs monitoring product). It does *NOT* control the internal debug logging of the agent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupLogAgent

func SetupLogAgent(conf *Config, tags map[string]string, tagger tagger.Component) logsAgent.ServerlessLogsAgent

SetupLogAgent creates the log agent and sets the base tags

Types

type ChannelWriter

type ChannelWriter struct {
	Buffer  bytes.Buffer
	Channel chan *logConfig.ChannelMessage
	IsError bool
}

ChannelWriter is a buffered writer that log lines (lines ending with a \n) to a channel to be sent to our intake.

func NewChannelWriter

func NewChannelWriter(ch chan *logConfig.ChannelMessage, isError bool) *ChannelWriter

NewChannelWriter returns a new channel writer. Implements io.Writer, used for redirecting stdout/stderr logs to Datadog.

func (*ChannelWriter) Write

func (cw *ChannelWriter) Write(p []byte) (n int, err error)

Write buffers Writes from our stdout/stderr fd, and sends to the channel once we've received newlines.

type Config

type Config struct {
	FlushTimeout time.Duration
	Channel      chan *logConfig.ChannelMessage

	IsEnabled bool
	// contains filtered or unexported fields
}

Config holds the log configuration

func CreateConfig

func CreateConfig(origin string) *Config

CreateConfig builds and returns a log config

Jump to

Keyboard shortcuts

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