-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated to latest disgohook, small cleanup & added builder example
- Loading branch information
Showing
13 changed files
with
191 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: gomod | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 | ||
- package-ecosystem: gomod | ||
directory: "/example" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 | ||
- package-ecosystem: gomod | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 | ||
- package-ecosystem: gomod | ||
directory: "/examples/factory_example" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 | ||
- package-ecosystem: gomod | ||
directory: "/examples/builder_example" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package main | ||
|
||
import ( | ||
"net/http" | ||
"os" | ||
"time" | ||
|
||
"github.com/DisgoOrg/dislog" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
var webhookToken = os.Getenv("webhook_token") | ||
|
||
var logger = logrus.New() | ||
var httpClient = http.DefaultClient | ||
|
||
func main() { | ||
// override default trace color | ||
dislog.TraceLevelColor = 0xd400ff | ||
|
||
// override default max delay | ||
dislog.LogWait = 1 * time.Second | ||
|
||
// override default time format | ||
dislog.TimeFormatter = "2006-01-02 15:04:05 Z07" | ||
|
||
logger.SetLevel(logrus.TraceLevel) | ||
logger.Info("starting examples...") | ||
dlog, err := dislog.NewDisLogBuilder(). | ||
// Sets which logrus.LogLevel the webhook client should log at if none is passed | ||
SetWebhookLoglevel(logrus.ErrorLevel). | ||
SetWebhookIDToken(webhookToken). | ||
// Sets a custom http client or nil for inbuilt | ||
SetHttpClient(httpClient). | ||
// Sets which logging levels to send to the webhook | ||
SetLevels(dislog.TraceLevelAndAbove...). | ||
Build() | ||
if err != nil { | ||
logger.Errorf("error initializing dislog %s", err) | ||
return | ||
} | ||
defer dlog.Close() | ||
logger.AddHook(dlog) | ||
|
||
logger.Trace("trace log") | ||
logger.Debug("debug log") | ||
logger.Info("info log") | ||
logger.Warn("warn log") | ||
logger.Error("error log") | ||
// Calls os.Exit(1) after logging | ||
logger.Fatal("fatal log") | ||
// Calls panic() after logging | ||
logger.Panic("panic log") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module github.com/DisgoOrg/dislog/examples/builder_example | ||
|
||
go 1.16 | ||
|
||
replace github.com/DisgoOrg/dislog => ../../ | ||
|
||
require ( | ||
github.com/DisgoOrg/dislog v1.0.0 | ||
github.com/sirupsen/logrus v1.8.1 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module github.com/DisgoOrg/dislog/examples/factory_example | ||
|
||
go 1.16 | ||
|
||
replace github.com/DisgoOrg/dislog => ../../ | ||
|
||
require ( | ||
github.com/DisgoOrg/dislog v1.0.0 | ||
github.com/sirupsen/logrus v1.8.1 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
github.com/DisgoOrg/disgohook v1.0.4 h1:qNUzkmXQBQ/ErwdYhHEEzvw9/rUcO3NBXBymm12ESvU= | ||
github.com/DisgoOrg/disgohook v1.0.4/go.mod h1:Psu7Ny9KlE81U9C5mcM2+vJkwlGCPfhPY+KorXbkKRo= | ||
github.com/DisgoOrg/disgohook v1.1.1 h1:tZi7FSmIvH/GjnkwLpgmvuX5fYmkOdqNAlfao6387mg= | ||
github.com/DisgoOrg/disgohook v1.1.1/go.mod h1:FmGSn1CtzlqIzKOwX7xgOGntjToxCQIcF/K6kEuZaVY= | ||
github.com/DisgoOrg/log v1.0.3 h1:IjmZQQu/kuBIui22EdXmxzQGYwcPCJEkXa0Fe6W9fJk= | ||
github.com/DisgoOrg/log v1.0.3/go.mod h1:KFGKhBQr37d6rxZ7p2bmc8BEmDH8DZbtgdlJDSCsE7I= | ||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= | ||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= | ||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= | ||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= | ||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4= | ||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= |
Oops, something went wrong.