Documentation
¶
Index ¶
- type LogRequestEntry
- func (b *LogRequestEntry) WithMessage(message string) *LogRequestEntry
- func (b *LogRequestEntry) WithPackage(pkg string) *LogRequestEntry
- func (b *LogRequestEntry) WithQueryParams(queryParams string) *LogRequestEntry
- func (b *LogRequestEntry) WithRemoteAddr(remoteAddr string) *LogRequestEntry
- func (b *LogRequestEntry) WithResponseTime(responseTime string) *LogRequestEntry
- func (b *LogRequestEntry) WithStatusCode(statusCode int) *LogRequestEntry
- func (b *LogRequestEntry) WithURL(url string) *LogRequestEntry
- func (b *LogRequestEntry) WithUserAgent(userAgent string) *LogRequestEntry
- type Logger
- type LoggingConstant
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogRequestEntry ¶
type LogRequestEntry struct { ContextID string `json:"context"` Package string `json:"package"` Method string `json:"method"` Message string `json:"message,omitempty"` URL string `json:"url,omitempty"` RemoteAddr string `json:"remote_addr,omitempty"` UserAgent string `json:"user_agent,omitempty"` StatusCode int `json:"status_code,omitempty"` ResponseTime string `json:"response_time,omitempty"` QueryParams string `json:"query_params,omitempty"` Timestamp time.Time `json:"timestamp"` }
LogRequestEntry defines the structure for our request log output
func NewLogRequestEntry ¶
func NewLogRequestEntry(contextID, method string, start time.Time) *LogRequestEntry
NewLogRequestEntry creates a new LogRequestEntry with required fields
func (*LogRequestEntry) WithMessage ¶
func (b *LogRequestEntry) WithMessage(message string) *LogRequestEntry
WithMessage sets the message field
func (*LogRequestEntry) WithPackage ¶
func (b *LogRequestEntry) WithPackage(pkg string) *LogRequestEntry
WithPackage sets a custom package name
func (*LogRequestEntry) WithQueryParams ¶
func (b *LogRequestEntry) WithQueryParams(queryParams string) *LogRequestEntry
WithQueryParams sets the QueryParams field
func (*LogRequestEntry) WithRemoteAddr ¶
func (b *LogRequestEntry) WithRemoteAddr(remoteAddr string) *LogRequestEntry
WithRemoteAddr sets the RemoteAddr field
func (*LogRequestEntry) WithResponseTime ¶
func (b *LogRequestEntry) WithResponseTime(responseTime string) *LogRequestEntry
WithResponseTime sets the ResponseTime field
func (*LogRequestEntry) WithStatusCode ¶
func (b *LogRequestEntry) WithStatusCode(statusCode int) *LogRequestEntry
WithStatusCode sets the StatusCode field
func (*LogRequestEntry) WithURL ¶
func (b *LogRequestEntry) WithURL(url string) *LogRequestEntry
WithURL sets the URL field
func (*LogRequestEntry) WithUserAgent ¶
func (b *LogRequestEntry) WithUserAgent(userAgent string) *LogRequestEntry
WithUserAgent sets the UserAgent field
type Logger ¶
type LoggingConstant ¶
type LoggingConstant string
const (
ContextIDKey LoggingConstant = "contextID"
)
Click to show internal directories.
Click to hide internal directories.