Update logging

This commit is contained in:
Kekskurse 2023-07-21 11:52:30 +02:00
parent 4b41ef1c55
commit 326b2e459e
Signed by: kekskurse
GPG key ID: 728ACCB59341E7E4
2 changed files with 31 additions and 1 deletions

View file

@ -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"

View file

@ -3,9 +3,11 @@ package main
import ( import (
_ "embed" _ "embed"
"encoding/json" "encoding/json"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
checks "http-server-status/internal/pkg/checks" checks "http-server-status/internal/pkg/checks"
"net/http" "net/http"
"os"
"sync" "sync"
"text/template" "text/template"
) )
@ -21,7 +23,9 @@ var checkList []checks.Check
func init() { func init() {
readConfig() 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}) 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})
} }