~repos /gromer

#golang#htmx#ssr

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

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


be0013ef Peter John

tag: v0.16.3

v0.16.3

3 years ago
fix cloud logging
Files changed (3) hide show
  1. go.mod +1 -0
  2. go.sum +2 -0
  3. 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
go.sum CHANGED
@@ -294,6 +294,8 @@ github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad
294
294
  github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
295
295
  github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
296
296
  github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
297
+ github.com/hirosassa/zerodriver v0.1.1 h1:VzQQcGPyzctzQ7VCHJa42+igu56uJz9HMypn0UoG+jw=
298
+ github.com/hirosassa/zerodriver v0.1.1/go.mod h1:+P2wLNeI1pgxJHbpyi2b6thTlfLjdN3Qptv34GNvXQA=
297
299
  github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
298
300
  github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
299
301
  github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
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