Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Theme = ThemeConfig{
Light: "light",
Dark: "dark",
Cupcake: "cupcake",
Bumblebee: "bumblebee",
Emerald: "emerald",
Corporate: "corporate",
Synthwave: "synthwave",
Retro: "retro",
Cyberpunk: "cyberpunk",
Valentine: "valentine",
Halloween: "halloween",
Garden: "garden",
Forest: "forest",
Aqua: "aqua",
Lofi: "lofi",
Pastel: "pastel",
Fantasy: "fantasy",
Wireframe: "wireframe",
Black: "black",
Luxury: "luxury",
Dracula: "dracula",
Cmyk: "cmyk",
Autumn: "autumn",
Business: "business",
Acid: "acid",
Lemonade: "lemonade",
Night: "night",
Coffee: "coffee",
Winter: "winter",
Dim: "dim",
Nord: "nord",
Sunset: "sunset",
Caramellatte: "caramellatte",
Abyss: "abyss",
Silk: "silk",
}
Functions ¶
Types ¶
type Config ¶
type Config struct {
// DatabasePath define the location where the sqlite database wil be stored
//
// Optional. Default: ./logs.sqlite
DatabasePath string
// WorkerBufferSize define the size of the worker buffer
//
// Optional. Default: 100
WorkerBufferSize int
// Path define the the base path to the logs view
// (it is recommended to use a path that is not publicly accessible)
// (e.g. /logs or /admin/logs)
//
// If set manually, it is recommended to also set the ExcludeRoutes and ExcludePatterns
//
// Optional. Default: /logs
Path string
// ExcludePaths define the paths to exclude from logging
//
// Optional. Default: ["logs", "/favicon.ico"]
ExcludeRoutes []string
// ExcludePaths define the paths to exclude from logging
//
// Optional. Default: ["/logs/*"]
ExcludePatterns []string
// ExcludePAram define a parameter that will exclude the request from logging
//
// Optional. Default: ""
ExcludeParam string
// LogDetailMember define the member name that will be used to store the log details in the request context
//
// Optional. Default: "logDetail"
LogDetailMember string
// SecureByPassword define if the logs view should be secured by a password
//
// Optional. Default: true
SecureByPassword *bool
// Password define the password to secure the logs view
// (it is recommended to store it in an environment variable)
//
// Optional. Default: "password"
Password string
// JwtSecret define the secret to sign the JWT token
// (it is recommended to store it in an environment variable)
//
// Optional. Default: "secret"
JwtSecret string
// JwtExpireTime define the expiration time of the JWT token in seconds
//
// Optional. Default: 3600
// (1 hour)
JwtExpireTime int64
// Theme define the theme of the logs view
//
// Optional. Default: ThemeConfig.Dark
// (see https://daisyui.com/theme-generator/)
Theme string
// JwtSigningMethod define the signing method to use for the JWT token
//
// Optional. Default: jwt.SigningMethodHS256
JwtSigningMethod jwt.SigningMethod
// AuthTokenCookieName define the name of the cookie that will be used to store the JWT token
//
// Optional. Default: "auth_token"
AuthTokenCookieName string
// IncludeLogPageConnexion define if the connexion via password to the logs page should be logged
//
// Optional. Default: true
IncludeLogPageConnexion *bool
}
Config define the configuration for the logger middleware
It is recommended to use the default configuration and override only the values you need
type LogEntry ¶
type LogEntry struct {
ID int64 `db:"id" json:"id"`
IPAddress string `db:"ip_address" json:"ip_address"`
Url string `db:"url" json:"url"`
Action string `db:"action" json:"action"`
Details *string `db:"details" json:"details,omitempty"` // nullable, omis si nil
Timestamp time.Time `db:"timestamp" json:"timestamp"`
UserAgent *string `db:"user_agent" json:"user_agent,omitempty"` // nullable, omis si nil
Status *string `db:"status" json:"status,omitempty"` // nullable, omis si nil
Latency int64 `db:"latency" json:"latency"`
}
func GetAllLogs ¶
func GetLogById ¶
type ThemeConfig ¶
type ThemeConfig struct {
Light string
Dark string
Cupcake string
Bumblebee string
Emerald string
Corporate string
Synthwave string
Retro string
Cyberpunk string
Valentine string
Halloween string
Garden string
Forest string
Aqua string
Lofi string
Pastel string
Fantasy string
Wireframe string
Black string
Luxury string
Dracula string
Cmyk string
Autumn string
Business string
Acid string
Lemonade string
Night string
Coffee string
Winter string
Dim string
Nord string
Sunset string
Caramellatte string
Abyss string
Silk string
}
Theme represents the theme of the logger.
It represent the daisyui themes.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.
