logging

package
v0.0.0-...-1643d90 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2020 License: UPL-1.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Response_Succeeded string = "succeeded"
	Response_Failed    string = "failed"

	Request_default_key  string = "requestValue"
	Response_default_key string = "responseValue"

	Audit_Prefix string = "[AUDIT]"

	TenantID_key     = "tenantid"
	Target_Index_Key = "target_index"
)
View Source
const (
	FORMATTER_TEXT = "text"
	FORMATTER_JSON = "json"
)

Variables

This section is empty.

Functions

func AuditLog

func AuditLog() *log.Logger

func InitAuditLog

func InitAuditLog(cfg *LogConfig) error

Initialize Audit Logger

func InitLog

func InitLog(cfg *LogConfig) error

InitLog initializes the standard logger instance

func InitLogInstance

func InitLogInstance(logger *log.Logger, cfg *LogConfig) error

InitLogInstance initializes the specific logger instance

func SetTenantID

func SetTenantID(tid string)

func WriteFailedAuditLog

func WriteFailedAuditLog(apiName string, reqFields map[string]interface{}, reason string)

The request may have multiple contextual fields

func WriteSimpleFailedAuditLog

func WriteSimpleFailedAuditLog(apiName string, reqField interface{}, reason string)

The request has only one contextual field

func WriteSimpleSucceededAuditLog

func WriteSimpleSucceededAuditLog(apiName string, reqField interface{}, respField interface{})

The request or response have only one contextual field

func WriteSucceededAuditLog

func WriteSucceededAuditLog(apiName string, reqFields map[string]interface{}, respFields map[string]interface{})

The request or response may have multiple contextual fields

Types

type LogConfig

type LogConfig struct {
	Level           string             `json:"level,omitempty"`
	Formatter       string             `json:"formatter,omitempty"`
	SetReportCaller bool               `json:"setReportCaller,omitempty"`
	RotationConfig  *lumberjack.Logger `json:"rotationConfig,omitempty"`
}

LogConfig is the struct for the logger

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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