Documentation ¶
Index ¶
- Variables
- func Debug(ctx context.Context, msg string, fields ...zap.Field)
- func Error(ctx context.Context, msg string, err error, fields ...zap.Field)
- func Fatal(ctx context.Context, msg string, err error, fields ...zap.Field)
- func Info(ctx context.Context, msg string, fields ...zap.Field)
- func NewArrayStringField(key string, value []string) zap.Field
- func NewBooleanField(key string, value bool) zap.Field
- func NewInt64Field(key string, value int64) zap.Field
- func NewIntField(key string, value int) zap.Field
- func NewObjectField(key string, value interface{}) zap.Field
- func NewStringField(key string, value string) zap.Field
- func Panic(ctx context.Context, msg string, err error, fields ...zap.Field)
- func TDR(ctx context.Context, model LogModel)
- func Warn(ctx context.Context, msg string, fields ...zap.Field)
- type Config
- type Log
- func (l *Log) Debug(ctx context.Context, msg string, fields ...zap.Field)
- func (l *Log) Error(ctx context.Context, msg string, err error, fields ...zap.Field)
- func (l *Log) Fatal(ctx context.Context, msg string, err error, fields ...zap.Field)
- func (l *Log) Info(ctx context.Context, msg string, fields ...zap.Field)
- func (l *Log) Panic(ctx context.Context, msg string, err error, fields ...zap.Field)
- func (l *Log) TDR(ctx context.Context, log LogModel)
- func (l *Log) Warn(ctx context.Context, msg string, fields ...zap.Field)
- type LogModel
- type LoggerInterface
Constants ¶
This section is empty.
Variables ¶
View Source
var SENSITIVE_ATTR = map[string]bool{ "password": true, "license": true, "license_code": true, "token": true, "access_token": true, "refresh_token": true, "bank_ac_no": true, "id_number": true, "mobile": true, "npwp": true, "phone": true, "card_no": true, "basic_salary": true, "brutto": true, "employment_deduction": true, "functional_allowance": true, "health_allowance": true, "health_deduction": true, "incentive_income_tax_21": true, "income_tax_21": true, "jht_allowance": true, "jkk_allowance": true, "jkm_allowance": true, "jkn_allowance": true, "loan": true, "other_deduction": true, "position_allowance": true, "skill_allowance": true, "special_region_allowance": true, "take_home_pay": true, "total_allowance": true, "total_deduction": true, "total_wages": true, }
View Source
var SENSITIVE_HEADER = []string{
"Authorization",
"Signature",
"Apikey",
}
Functions ¶
func Fatal ¶
Fatal logs a message at FatalLevel.
The logger then calls os.Exit(1), even if logging at FatalLevel is disabled.
func NewArrayStringField ¶ added in v1.0.5
func NewObjectField ¶ added in v1.0.5
func Panic ¶
Panic logs a message at PanicLevel.
The logger then panics, even if logging at PanicLevel is disabled.
Types ¶
type Config ¶
type Config struct { // App name App string `json:"app"` // App Version AppVer string `json:"appVer"` // Log environment (development or production) Env string `json:"env"` // Location where the system log will be saved FileLocation string `json:"fileLocation"` // Location where the tdr log will be saved FileTDRLocation string `json:"fileTDRLocation"` // Maximum size of a single log file. // If the capacity reach, file will be saved but it will be renamed // with suffix the current date FileMaxSize int `json:"fileMaxSize"` // Maximum number of backup file that will not be deleted FileMaxBackup int `json:"fileMaxBackup"` // Number of days where the backup log will not be deleted FileMaxAge int `json:"fileMaxAge"` // Log will be printed in console if the value is true Stdout bool `json:"stdout"` }
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
type LogModel ¶
type LogModel struct { TraceID string `json:"traceId"` CorrelationID string `json:"correlationId"` SrcIP string `json:"srcIp"` IP string `json:"ip"` Port string `json:"port"` Path string `json:"path"` Header interface{} `json:"header"` Request interface{} `json:"request"` StatusCode string `json:"statusCode"` HttpStatus uint64 `json:"httpStatus"` Response interface{} `json:"response"` ResponseTime time.Duration `json:"rt"` Error interface{} `json:"error"` OtherData interface{} `json:"otherData"` }
type LoggerInterface ¶
type LoggerInterface interface { Debug(ctx context.Context, message string, fields ...zap.Field) Info(ctx context.Context, message string, fields ...zap.Field) Warn(ctx context.Context, message string, fields ...zap.Field) Error(ctx context.Context, message string, err error, fields ...zap.Field) Fatal(ctx context.Context, message string, err error, fields ...zap.Field) Panic(ctx context.Context, message string, err error, fields ...zap.Field) TDR(ctx context.Context, tdr LogModel) }
func NewLogger ¶
func NewLogger(conf Config) LoggerInterface
Click to show internal directories.
Click to hide internal directories.