From 326b2e459ee801643ad75fda566d980c3de81c58 Mon Sep 17 00:00:00 2001 From: kekskurse Date: Fri, 21 Jul 2023 11:52:30 +0200 Subject: [PATCH] Update logging --- .forgejo/workflows/release.yml | 26 ++++++++++++++++++++++++++ main.go | 6 +++++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 .forgejo/workflows/release.yml diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml new file mode 100644 index 0000000..c818b1d --- /dev/null +++ b/.forgejo/workflows/release.yml @@ -0,0 +1,26 @@ +: Dev Version +run-name: ${{ github.actor }} is testing +on: ["push"] +jobs: + Release: + runs-on: docker + #container: + # image: goreleaser/goreleaser + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + #- run: goreleaser release --skip-publish --snapshot --rm-dist --debug + - name: Setup Go environment + uses: https://github.com/actions/setup-go@v2.1.3 + with: + go-version: 1.20 + - name: Run GoReleaser + uses: https://github.com/goreleaser/goreleaser-action@v4 + with: + # either 'goreleaser' (default) or 'goreleaser-pro' + distribution: goreleaser + version: latest + args: release --clean + env: + GORELEASER_FORCE_TOKEN: "gitea" \ No newline at end of file diff --git a/main.go b/main.go index 4d407cf..d1319ba 100644 --- a/main.go +++ b/main.go @@ -3,9 +3,11 @@ package main import ( _ "embed" "encoding/json" + "github.com/rs/zerolog" "github.com/rs/zerolog/log" checks "http-server-status/internal/pkg/checks" "net/http" + "os" "sync" "text/template" ) @@ -21,7 +23,9 @@ var checkList []checks.Check func init() { readConfig() - log.Debug().Int("max_percent", c.Checks.HDD.MaxPercent).Msg("HDD CHECK") + pp := log.Output(zerolog.ConsoleWriter{Out: os.Stdout}) + multi := zerolog.MultiLevelWriter(pp) + log.Logger = zerolog.New(multi).With().Timestamp().Caller().Logger() checkList = append(checkList, checks.HDD{c.Checks.HDD}, checks.Memory{Config: c.Checks.Memory}, checks.Load{Config: c.Checks.Load}, checks.Systemd{Config: c.Checks.Systemd}, checks.Version{Config: c.Checks.Version}) }