Documentation ¶
Overview ¶
Package base logger notes: varied FOSS projects, gists, blogs etc inspired this effort to adapt ZAP and Lumberjack for OSFCI's base library. There are many proects to list and if someone can find a go package that closely represents all the functions here, please let us know.
Package base logger notes: same as zap.go
Index ¶
- Constants
- Variables
- func CheckPasswordHash(password, hash string) bool
- func CheckURLExists(request string) bool
- func Debugf(format string, args ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatalf(format string, args ...interface{})
- func GenerateAccountACKLink(length int) string
- func GenerateAuthToken(TokenType string, length int) string
- func GetClientIP(r *http.Request) string
- func HTTPDeleteRequest(request string)
- func HTTPGetBody(r *http.Request) []byte
- func HTTPGetRequest(request string) string
- func HTTPPutRequest(request string, content []byte, contentType string) string
- func HashPassword(password string) (string, error)
- func Infof(format string, args ...interface{})
- func InitProhibitedIPs() error
- func NewLogger(config Configuration) error
- func Panicf(format string, args ...interface{})
- func Request(method string, resURI string, Path string, Data string, content []byte, ...) (*http.Response, error)
- func SendEmail(email string, subject string, validationString string)
- func UpdateProhibitedIPs(blockedIPs string)
- func ValidateClientIP(req *http.Request) bool
- func ValidateDomain(userEmail string) bool
- func Warnf(format string, args ...interface{})
- type Configuration
- type Fields
- type Logger
- type Prohibited
- type User
Constants ¶
const ( //Debug for verbose logging Debug = "debug" //Info for info logging Info = "info" //Warn for warning logs Warn = "warn" //Error for error logs Error = "error" //Fatal is for logging fatal messages. The system shutsdown after logging the message. Fatal = "fatal" )
const ( //InstanceZapLogger for instance InstanceZapLogger int = iota )
Variables ¶
var MaxAge = 3600 * 24
MaxAge defines cookie expiration
var ProhibitedDomains string
Functions ¶
func CheckPasswordHash ¶
CheckPasswordHash checks given password
func CheckURLExists ¶
CheckURLExists handles checks ia URL exists
func GenerateAccountACKLink ¶
GenerateAccountACKLink generates account verification link
func GenerateAuthToken ¶
GenerateAuthToken creates auth token for created user
func GetClientIP ¶
func HTTPDeleteRequest ¶
func HTTPDeleteRequest(request string)
HTTPDeleteRequest handles Delete request to backend
func HTTPGetBody ¶
HTTPGetBody handles request body for redirects
func HTTPGetRequest ¶
HTTPGetRequest handles some HTTP request Get request to the storage backend
func HTTPPutRequest ¶
HTTPPutRequest handles Put request to the storage backend
func HashPassword ¶
HashPassword gets hash from password
func InitProhibitedIPs ¶
func InitProhibitedIPs() error
func Request ¶
func Request(method string, resURI string, Path string, Data string, content []byte, query string, Key string, SecretKey string) (*http.Response, error)
Request handler
func UpdateProhibitedIPs ¶
func UpdateProhibitedIPs(blockedIPs string)
func ValidateClientIP ¶
func ValidateDomain ¶
Types ¶
type Configuration ¶
type Configuration struct { EnableConsole bool ConsoleJSONFormat bool ConsoleLevel string EnableFile bool FileJSONFormat bool FileLevel string FileLocation string }
Configuration stores the config for the logger
type Fields ¶
type Fields map[string]interface{}
Fields Type to pass when we want to call WithFields for structured logging
type Logger ¶
type Logger interface { //Debugf level interface Debugf(format string, args ...interface{}) //Infof level interface Infof(format string, args ...interface{}) //Warnf level interface Warnf(format string, args ...interface{}) //Errorf level interface Errorf(format string, args ...interface{}) //Fatalf level interface Fatalf(format string, args ...interface{}) //Panic level interface Panicf(format string, args ...interface{}) }
Logger interface
var Zlog Logger
Zlog A global variable so that log functions can be directly accessed
type Prohibited ¶
type Prohibited struct {
// contains filtered or unexported fields
}
var ProhibitedIPs Prohibited