package log

import "github.com/Azure/azure-sdk-for-go/sdk/internal/log"

Index

Functions

func SetClassifications

func SetClassifications(cls ...Classification)

SetClassifications is used to control which classifications are written to the log. By default all log classifications are writen.

func SetListener

func SetListener(lst func(Classification, string))

SetListener will set the Logger to write to the specified listener.

func Should

func Should(cls Classification) bool

Should returns true if the specified log classification should be written to the log. By default all log classifications will be logged. Call SetClassification() to limit the log classifications for logging. If no listener has been set this will return false. Calling this method is useful when the message to log is computationally expensive and you want to avoid the overhead if its log classification is not enabled.

func TestResetClassifications

func TestResetClassifications()

TestResetClassifications is used for testing purposes only.

func Write

func Write(cls Classification, message string)

Write invokes the underlying listener with the specified classification and message. If the classification shouldn't be logged or there is no listener then Write does nothing.

func Writef

func Writef(cls Classification, format string, a ...interface{})

Writef invokes the underlying listener with the specified classification and formatted message. If the classification shouldn't be logged or there is no listener then Writef does nothing.

Types

type Classification

type Classification string

Classification is used to group entries. Each group can be toggled on or off

const (
	// Request entries contain information about HTTP requests.
	// This includes information like the URL, query parameters, and headers.
	Request Classification = "Request"

	// Response entries containe information about HTTP responses.
	// This includes information like the HTTP status code, headers, and request URL.
	Response Classification = "Response"

	// RetryPolicy entries contain information specific to the rety policy in use.
	RetryPolicy Classification = "RetryPolicy"

	// LongRunningOperation entries contian information specific to long-running operations.
	// This includes information like polling location, operation state, and sleep intervals.
	LongRunningOperation Classification = "LongRunningOperation"
)

Source Files

log.go

Version
v0.6.1
Published
Aug 17, 2021
Platform
linux/amd64
Imports
3 packages
Last checked
1 minute ago

Tools for package owners.