develop #14
3 changed files with 22 additions and 0 deletions
2
.env-dev
2
.env-dev
|
|
@ -14,6 +14,8 @@ App_HTTPS_HOSTS=example.com, www.example.com
|
||||||
App_REDIRECT_HTTP_TO_HTTPS=false
|
App_REDIRECT_HTTP_TO_HTTPS=false
|
||||||
App_CERT_FILE_PATH=tls/server.crt
|
App_CERT_FILE_PATH=tls/server.crt
|
||||||
App_KEY_FILE_PATH=tls/server.key
|
App_KEY_FILE_PATH=tls/server.key
|
||||||
|
LOG_STDOUT_ENABLE=true
|
||||||
|
LOG_LEVEL=debug
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
###### TEMPLATES ######
|
###### TEMPLATES ######
|
||||||
|
|
|
||||||
|
|
@ -874,6 +874,13 @@ func TemplatesFunctions(c *core.Context) *core.Response {
|
||||||
TemplateEnable, _ := strconv.ParseBool(TemplateEnableStr)
|
TemplateEnable, _ := strconv.ParseBool(TemplateEnableStr)
|
||||||
|
|
||||||
if TemplateEnable {
|
if TemplateEnable {
|
||||||
|
loggr := c.GetLogger()
|
||||||
|
|
||||||
|
loggr.Debug("D e b u g")
|
||||||
|
loggr.Info("I n f o")
|
||||||
|
loggr.Warning("W a r n i n g")
|
||||||
|
loggr.Error("E R R O R")
|
||||||
|
|
||||||
|
|
||||||
tmplData := SamplePageData()
|
tmplData := SamplePageData()
|
||||||
return c.Response.Template("custom_templates_functions.html", tmplData)
|
return c.Response.Template("custom_templates_functions.html", tmplData)
|
||||||
|
|
|
||||||
13
main.go
13
main.go
|
|
@ -58,6 +58,19 @@ func main() {
|
||||||
app.SetGormConfig(config.GetGormConfig())
|
app.SetGormConfig(config.GetGormConfig())
|
||||||
app.SetCacheConfig(config.GetCacheConfig())
|
app.SetCacheConfig(config.GetCacheConfig())
|
||||||
app.Bootstrap()
|
app.Bootstrap()
|
||||||
|
// Set log level from environment variable (debug, info, warning, error)
|
||||||
|
if levelStr := env.GetVar("LOG_LEVEL"); levelStr != "" {
|
||||||
|
switch levelStr {
|
||||||
|
case "debug":
|
||||||
|
logger.ResolveLogger().SetLevel(logger.DEBUG)
|
||||||
|
case "info":
|
||||||
|
logger.ResolveLogger().SetLevel(logger.INFO)
|
||||||
|
case "warning":
|
||||||
|
logger.ResolveLogger().SetLevel(logger.WARNING)
|
||||||
|
case "error":
|
||||||
|
logger.ResolveLogger().SetLevel(logger.ERROR)
|
||||||
|
}
|
||||||
|
}
|
||||||
app.RegisterTemplates(resources)
|
app.RegisterTemplates(resources)
|
||||||
registerGlobalHooks()
|
registerGlobalHooks()
|
||||||
registerRoutes()
|
registerRoutes()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue