Skip to content

Commit

Permalink
fix(windows): [#270] Omit syslog.
Browse files Browse the repository at this point in the history
  • Loading branch information
030 committed Oct 30, 2022
1 parent b2a040f commit b4590d3
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 202 deletions.
8 changes: 3 additions & 5 deletions cmd/n3dr/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ import (
_ "embed"
"fmt"
"io"
"log/syslog"
"net/http"
"os"
"path/filepath"
"runtime"

cli "github.com/030/n3dr/internal/app/n3dr/artifacts"
homedir "github.com/mitchellh/go-homedir"
log "github.com/sirupsen/logrus"
logrus_syslog "github.com/sirupsen/logrus/hooks/syslog"
"github.com/sirupsen/logrus/hooks/writer"
"github.com/spf13/cobra"
jww "github.com/spf13/jwalterweatherman"
Expand Down Expand Up @@ -252,9 +251,8 @@ func logging() (err error) {
DisableColors: true,
})

hook, err := logrus_syslog.NewSyslogHook("", "", syslog.LOG_INFO, "")
if err == nil {
log.AddHook(hook)
if runtime.GOOS != "windows" {
logFileSyslog()
}
}

Expand Down
17 changes: 17 additions & 0 deletions cmd/n3dr/root_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//go:build !windows

package main

import (
"log/syslog"

log "github.com/sirupsen/logrus"
logrus_syslog "github.com/sirupsen/logrus/hooks/syslog"
)

func logFileSyslog() {
hook, err := logrus_syslog.NewSyslogHook("", "", syslog.LOG_INFO, "")
if err == nil {
log.AddHook(hook)
}
}
7 changes: 7 additions & 0 deletions cmd/n3dr/root_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//go:build windows

package main

func logFileSyslog() {

}
30 changes: 8 additions & 22 deletions configs/chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,37 @@
{{ if .Versions -}}
<a name="unreleased"></a>

## [Unreleased]

{{ if .Unreleased.CommitGroups -}}
{{ range .Unreleased.CommitGroups -}}

### {{ .Title }}

{{ range .Commits -}}

- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>

## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}

{{ range .CommitGroups -}}

### {{ .Title }}

{{ range .Commits -}}

- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}
{{ end }}
{{ end -}}

{{- if .RevertCommits -}}

### Reverts

{{ range .RevertCommits -}}

- {{ .Revert.Header }}
{{ end }}
{{ end -}}
{{ end }}
{{ end -}}

{{- if .NoteGroups -}}
{{ range .NoteGroups -}}

### {{ .Title }}

{{ range .Notes }}
{{ .Body }}
{{ end }}
Expand Down
Loading

0 comments on commit b4590d3

Please sign in to comment.