Documentation
¶
Index ¶
- Constants
- Variables
- type Config
- type Option
- func WithGcp(gcp bool) Option
- func WithGcpHttpContextExtractor(gcpHttpContextExtractor *gcpHttpContextExtractor.Extractor) Option
- func WithHttpContextExtractor(httpContextExtractor *http_context_extractor.Extractor) Option
- func WithLogLevel(logLevel slog.Level) Option
- func WithWriter(writer io.Writer) Option
Constants ¶
View Source
const DefaultLogLevel = slog.LevelInfo
Variables ¶
View Source
var DefaultReplaceableMessages = []string{ altshiftMux.ClientErrorMessage, altshiftMux.ServerErrorMessage, altshiftMux.ResponseServedMessage, altshiftHttpUtils.FetchPerformedMessage, }
DefaultReplaceableMessages are the messages this module logs where what is worth reading about the request is in the HTTP context rather than in the message. The extractor that reads that context replaces them with what it says; see http_context_extractor_config.WithReplaceableMessages.
View Source
var DefaultWriter io.Writer = os.Stdout
DefaultWriter is where the entries go unless told otherwise. Standard output is where a process whose logs are collected for it is expected to write them.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Writer io.Writer
LogLevel slog.Level
// HttpContextExtractor adds what is known about the request being logged. Unless one is set, an
// extractor that replaces DefaultReplaceableMessages is.
HttpContextExtractor *http_context_extractor.Extractor
// Gcp makes the logger write what Google Cloud Logging expects of it: the names it reads the
// severity and the message under, the fields it reads a request under, and entries within the
// size it accepts. It is off by default, the rest being of no use to anything else.
Gcp bool
// GcpHttpContextExtractor adds what Cloud Logging reads a request under. Unless one is set, and
// where Gcp is, a default one is.
GcpHttpContextExtractor *gcpHttpContextExtractor.Extractor
}
type Option ¶
type Option func(*Config)
func WithGcp ¶
WithGcp makes the logger write what Google Cloud Logging expects of it, which nothing else reads.
func WithGcpHttpContextExtractor ¶
func WithGcpHttpContextExtractor(gcpHttpContextExtractor *gcpHttpContextExtractor.Extractor) Option
WithGcpHttpContextExtractor sets what adds the fields Cloud Logging reads a request under. It is used only where WithGcp is.
func WithHttpContextExtractor ¶
func WithHttpContextExtractor(httpContextExtractor *http_context_extractor.Extractor) Option
func WithLogLevel ¶
func WithWriter ¶
Click to show internal directories.
Click to hide internal directories.