gromer

#golang#htmx#ssr

git clone https://git.pyrossh.dev/gromer

gromer is a framework and cli to build multipage web apps in golang using htmx and alpinejs.


12706ee — Peter John 2022-04-15T18:01:36+05:30
fix cloud logging

Generated files not shown: go.sum

Files changed (2) hide show
  1. go.mod +1 -0
  2. http.go +9 -5
go.mod CHANGED
@@ -34,6 +34,7 @@ require (
34
34
  github.com/google/wire v0.5.0 // indirect
35
35
  github.com/googleapis/gax-go/v2 v2.1.0 // indirect
36
36
  github.com/gorilla/css v1.0.0 // indirect
37
+ github.com/hirosassa/zerodriver v0.1.1 // indirect
37
38
  github.com/joho/godotenv v1.3.0 // indirect
38
39
  github.com/leodido/go-urn v1.2.1 // indirect
39
40
  github.com/markbates/inflect v1.0.4 // indirect
http.go CHANGED
@@ -19,6 +19,7 @@ import (
19
19
 
20
20
  "github.com/go-playground/validator/v10"
21
21
  "github.com/gorilla/mux"
22
+ "github.com/hirosassa/zerodriver"
22
23
  "github.com/pyros2097/gromer/handlebars"
23
24
  "github.com/rs/zerolog"
24
25
  "github.com/rs/zerolog/log"
@@ -33,11 +34,14 @@ func init() {
33
34
  IsCloundRun = os.Getenv("K_REVISION") != ""
34
35
  info, _ = debug.ReadBuildInfo()
35
36
  zerolog.ErrorStackMarshaler = pkgerrors.MarshalStack
37
+ if IsCloundRun {
38
+ log.Logger = log.Output(zerodriver.NewProductionLogger())
39
+ } else {
36
- log.Logger = log.Output(zerolog.ConsoleWriter{
40
+ log.Logger = log.Output(zerolog.ConsoleWriter{
37
- Out: os.Stdout,
41
+ Out: os.Stdout,
38
- TimeFormat: zerolog.TimeFormatUnix,
42
+ TimeFormat: zerolog.TimeFormatUnix,
39
- NoColor: IsCloundRun,
40
- })
43
+ })
44
+ }
41
45
  }
42
46
 
43
47
  var RouteDefs []RouteDefinition