Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from LobbyLobster/master
Browse files Browse the repository at this point in the history
  • Loading branch information
xeome authored Aug 2, 2023
2 parents ccade44 + c168d2b commit e9d4432
Show file tree
Hide file tree
Showing 19 changed files with 207 additions and 246 deletions.
Empty file modified .github/workflows/release.yml
100644 → 100755
Empty file.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified .goreleaser.yaml
100644 → 100755
Empty file.
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified README.tr.md
100644 → 100755
Empty file.
431 changes: 192 additions & 239 deletions backup/dumper.go
100644 → 100755

Large diffs are not rendered by default.

Empty file modified backup/logger.go
100644 → 100755
Empty file.
Empty file modified backup/minio.go
100644 → 100755
Empty file.
Empty file modified backup/s3.go
100644 → 100755
Empty file.
Empty file modified config/config.sample.yml
100644 → 100755
Empty file.
7 changes: 3 additions & 4 deletions config/params.go
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package config

import (
"flag"
log2 "log"
"os"
"pgsql-backup/log"

Expand Down Expand Up @@ -67,19 +66,19 @@ func NewParams() (p *Params) {
flag.Parse()

if _, err := os.Stat(*filePath); os.IsNotExist(err) {
log2.Fatalf("Configuration file: %s does not exist, %v\n", *filePath, err)
log.Fatal("Configuration file: %s does not exist, %v\n", *filePath, err)
}

viper.SetConfigFile(*filePath)
viper.SetConfigType("yaml")

if err := viper.ReadInConfig(); err != nil {
log2.Fatalf("Error reading config file, %s", err)
log.Fatal("Error reading config file, %s\n", err)
}

err := viper.Unmarshal(&p)
if err != nil {
log2.Fatalf("Unable to decode into struct, %v\n", err)
log.Fatal("Unable to decode into struct, %v\n", err)
}

p.Fqdn, _ = os.Hostname()
Expand Down
Empty file modified go.mod
100644 → 100755
Empty file.
Empty file modified go.sum
100644 → 100755
Empty file.
15 changes: 12 additions & 3 deletions log/logger.go
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package log

import (
"os"
"runtime"
"strconv"
"strings"
"time"

"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -34,10 +37,16 @@ func NewLogger(params *Params) (l *Logger) {

logger := logrus.New()
logger.SetFormatter(&logrus.TextFormatter{
FullTimestamp: true,
DisableLevelTruncation: true,
PadLevelText: true,
ForceColors: true,
FullTimestamp: true,
TimestampFormat: "2006-01-02 15:04:05",
CallerPrettyfier: func(f *runtime.Frame) (string, string) {
slash := strings.LastIndex(f.File, "/")
filename := f.File[slash+1:]
return "", "[" + filename + ":" + strconv.Itoa(f.Line) + "]"
},
})
logger.SetReportCaller(true)

l = &Logger{
Params: params,
Expand Down
Empty file modified main.go
100644 → 100755
Empty file.
Empty file modified notify/email.go
100644 → 100755
Empty file.
Empty file modified notify/mattermost.go
100644 → 100755
Empty file.
Empty file modified pgsql-backup.iml
100644 → 100755
Empty file.

0 comments on commit e9d4432

Please sign in to comment.