Skip to content

Commit b47996a

Browse files
committed
Reduced logs noise
1 parent cef2f59 commit b47996a

5 files changed

Lines changed: 3235 additions & 2739 deletions

File tree

docker/web/start.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
set -e
1+
set -ex
22

3-
npm install
3+
yarn install
44
yarn serve

internal/common/logs/logrus.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ import (
99
)
1010

1111
func Init() {
12-
logrus.SetFormatter(&logrus.JSONFormatter{
12+
SetFormatter(logrus.StandardLogger())
13+
14+
logrus.SetLevel(logrus.DebugLevel)
15+
}
16+
17+
func SetFormatter(logger *logrus.Logger) {
18+
logger.SetFormatter(&logrus.JSONFormatter{
1319
FieldMap: logrus.FieldMap{
1420
logrus.FieldKeyTime: "time",
1521
logrus.FieldKeyLevel: "severity",
@@ -18,10 +24,8 @@ func Init() {
1824
})
1925

2026
if isLocalEnv, _ := strconv.ParseBool(os.Getenv("LOCAL_ENV")); isLocalEnv {
21-
logrus.SetFormatter(&prefixed.TextFormatter{
27+
logger.SetFormatter(&prefixed.TextFormatter{
2228
ForceFormatting: true,
2329
})
2430
}
25-
26-
logrus.SetLevel(logrus.DebugLevel)
2731
}

internal/common/server/grpc.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"net"
66
"os"
77

8+
"github.com/ThreeDotsLabs/wild-workouts-go-ddd-example/internal/common/logs"
89
grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
910
grpc_logrus "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus"
1011
grpc_ctxtags "github.com/grpc-ecosystem/go-grpc-middleware/tags"
@@ -13,7 +14,11 @@ import (
1314
)
1415

1516
func init() {
16-
grpc_logrus.ReplaceGrpcLogger(logrus.NewEntry(logrus.StandardLogger()))
17+
logger := logrus.New()
18+
logs.SetFormatter(logger)
19+
logger.SetLevel(logrus.WarnLevel)
20+
21+
grpc_logrus.ReplaceGrpcLogger(logrus.NewEntry(logger))
1722
}
1823

1924
func RunGRPCServer(registerServer func(server *grpc.Server)) {

web/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
},
1010
"dependencies": {
1111
"@babel/compat-data": "^7.9.0",
12+
"@babel/core": "^7.18.2",
1213
"@fullcalendar/core": "^4.4.2",
1314
"@fullcalendar/daygrid": "^4.4.2",
1415
"@fullcalendar/interaction": "^4.4.0",
1516
"@fullcalendar/list": "^4.4.0",
1617
"@fullcalendar/timegrid": "^4.4.0",
1718
"@fullcalendar/vue": "^4.4.0",
19+
"babel-loader": "^8.2.5",
1820
"bootstrap": "^4.4.1",
1921
"core-js": "^3.22.6",
2022
"firebase": "^7.14.0",
@@ -28,7 +30,8 @@
2830
"vue": "^2.6.11",
2931
"vue-router": "^3.1.6",
3032
"vue-toast-notification": "^0.2.0",
31-
"vuejs-dialog": "^1.4.1"
33+
"vuejs-dialog": "^1.4.1",
34+
"@babel/preset-env": "^7.10.2"
3235
},
3336
"devDependencies": {
3437
"@vue/cli-plugin-babel": "~4.2.0",

0 commit comments

Comments
 (0)