Skip to content

Commit

Permalink
Merge pull request #1 from NandosUK/logrus-capitalise-level-value
Browse files Browse the repository at this point in the history
logrus fork
  • Loading branch information
mikewotton authored Feb 12, 2021
2 parents cd4bf4e + efb8b1f commit b8d7df0
Show file tree
Hide file tree
Showing 25 changed files with 54 additions and 55 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ The simplest way to use Logrus is simply the package-level exported logger:
package main

import (
log "github.com/sirupsen/logrus"
log "github.com/nandosuk/logrus"
)

func main() {
Expand All @@ -130,7 +130,7 @@ func main() {
```

Note that it's completely api-compatible with the stdlib logger, so you can
replace your `log` imports everywhere with `log "github.com/sirupsen/logrus"`
replace your `log` imports everywhere with `log "github.com/nandosuk/logrus"`
and you'll now have the flexibility of Logrus. You can customize it all you
want:

Expand All @@ -139,7 +139,7 @@ package main

import (
"os"
log "github.com/sirupsen/logrus"
log "github.com/nandosuk/logrus"
)

func init() {
Expand Down Expand Up @@ -190,7 +190,7 @@ package main

import (
"os"
"github.com/sirupsen/logrus"
"github.com/nandosuk/logrus"
)

// Create a new instance of the logger. You can have any number of instances.
Expand Down Expand Up @@ -265,9 +265,9 @@ Logrus comes with [built-in hooks](hooks/). Add those, or your custom hook, in

```go
import (
log "github.com/sirupsen/logrus"
log "github.com/nandosuk/logrus"
"gopkg.in/gemnasium/logrus-airbrake-hook.v2" // the package is named "airbrake"
logrus_syslog "github.com/sirupsen/logrus/hooks/syslog"
logrus_syslog "github.com/nandosuk/logrus/hooks/syslog"
"log/syslog"
)

Expand Down Expand Up @@ -338,7 +338,7 @@ could do:

```go
import (
log "github.com/sirupsen/logrus"
log "github.com/nandosuk/logrus"
)

init() {
Expand Down Expand Up @@ -460,8 +460,8 @@ Logrus has a built in facility for asserting the presence of log messages. This

```go
import(
"github.com/sirupsen/logrus"
"github.com/sirupsen/logrus/hooks/test"
"github.com/nandosuk/logrus"
"github.com/nandosuk/logrus/hooks/test"
"github.com/stretchr/testify/assert"
"testing"
)
Expand Down
2 changes: 1 addition & 1 deletion doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The simplest way to use Logrus is simply the package-level exported logger:
package main
import (
log "github.com/sirupsen/logrus"
log "github.com/nandosuk/logrus"
)
func main() {
Expand Down
2 changes: 1 addition & 1 deletion example_basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package logrus_test
import (
"os"

"github.com/sirupsen/logrus"
"github.com/nandosuk/logrus"
)

func Example_basic() {
Expand Down
4 changes: 2 additions & 2 deletions example_custom_caller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"runtime"
"strings"

"github.com/sirupsen/logrus"
"github.com/nandosuk/logrus"
)

func ExampleJSONFormatter_CallerPrettyfier() {
Expand All @@ -24,5 +24,5 @@ func ExampleJSONFormatter_CallerPrettyfier() {
}
l.Info("example of custom format caller")
// Output:
// {"file":"example_custom_caller_test.go","func":"ExampleJSONFormatter_CallerPrettyfier","level":"info","msg":"example of custom format caller"}
// {"file":"example_custom_caller_test.go","func":"ExampleJSONFormatter_CallerPrettyfier","level":"INFO","msg":"example of custom format caller"}
}
2 changes: 1 addition & 1 deletion example_default_field_value_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package logrus_test
import (
"os"

"github.com/sirupsen/logrus"
"github.com/nandosuk/logrus"
)

type DefaultFieldHook struct {
Expand Down
2 changes: 1 addition & 1 deletion example_function_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package logrus_test
import (
"testing"

log "github.com/sirupsen/logrus"
log "github.com/nandosuk/logrus"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion example_global_hook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package logrus_test
import (
"os"

"github.com/sirupsen/logrus"
"github.com/nandosuk/logrus"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions example_hook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"log/syslog"
"os"

"github.com/sirupsen/logrus"
slhooks "github.com/sirupsen/logrus/hooks/syslog"
"github.com/nandosuk/logrus"
slhooks "github.com/nandosuk/logrus/hooks/syslog"
)

// An example on how to use a hook
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/sirupsen/logrus
module github.com/nandosuk/logrus

require (
github.com/davecgh/go-spew v1.1.1 // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
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-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
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=
4 changes: 2 additions & 2 deletions hook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

. "github.com/sirupsen/logrus"
. "github.com/sirupsen/logrus/internal/testutils"
. "github.com/nandosuk/logrus"
. "github.com/nandosuk/logrus/internal/testutils"
)

type TestHook struct {
Expand Down
8 changes: 4 additions & 4 deletions hooks/syslog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
```go
import (
"log/syslog"
"github.com/sirupsen/logrus"
lSyslog "github.com/sirupsen/logrus/hooks/syslog"
"github.com/nandosuk/logrus"
lSyslog "github.com/nandosuk/logrus/hooks/syslog"
)

func main() {
Expand All @@ -24,8 +24,8 @@ If you want to connect to local syslog (Ex. "/dev/log" or "/var/run/syslog" or "
```go
import (
"log/syslog"
"github.com/sirupsen/logrus"
lSyslog "github.com/sirupsen/logrus/hooks/syslog"
"github.com/nandosuk/logrus"
lSyslog "github.com/nandosuk/logrus/hooks/syslog"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion hooks/syslog/syslog.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"log/syslog"
"os"

"github.com/sirupsen/logrus"
"github.com/nandosuk/logrus"
)

// SyslogHook to send logs via syslog.
Expand Down
2 changes: 1 addition & 1 deletion hooks/syslog/syslog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"log/syslog"
"testing"

"github.com/sirupsen/logrus"
"github.com/nandosuk/logrus"
)

func TestLocalhostAddAndPrint(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion hooks/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"io/ioutil"
"sync"

"github.com/sirupsen/logrus"
"github.com/nandosuk/logrus"
)

// Hook is a hook designed for dealing with logs in test scenarios.
Expand Down
2 changes: 1 addition & 1 deletion hooks/test/test_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"
"time"

"github.com/sirupsen/logrus"
"github.com/nandosuk/logrus"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions hooks/writer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"io/ioutil"
"os"

log "github.com/sirupsen/logrus"
"github.com/sirupsen/logrus/hooks/writer"
log "github.com/nandosuk/logrus"
"github.com/nandosuk/logrus/hooks/writer"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion hooks/writer/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package writer
import (
"io"

log "github.com/sirupsen/logrus"
log "github.com/nandosuk/logrus"
)

// Hook is a hook that writes logs of specified LogLevels to specified Writer
Expand Down
2 changes: 1 addition & 1 deletion hooks/writer/writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"io/ioutil"
"testing"

log "github.com/sirupsen/logrus"
log "github.com/nandosuk/logrus"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/testutils/testutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"
"testing"

. "github.com/sirupsen/logrus"
. "github.com/nandosuk/logrus"

"github.com/stretchr/testify/require"
)
Expand Down
3 changes: 2 additions & 1 deletion json_formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"runtime"
"strings"
)

type fieldKey string
Expand Down Expand Up @@ -90,7 +91,7 @@ func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) {
data[f.FieldMap.resolve(FieldKeyTime)] = entry.Time.Format(timestampFormat)
}
data[f.FieldMap.resolve(FieldKeyMsg)] = entry.Message
data[f.FieldMap.resolve(FieldKeyLevel)] = entry.Level.String()
data[f.FieldMap.resolve(FieldKeyLevel)] = strings.ToUpper(entry.Level.String())
if entry.HasCaller() {
funcVal := entry.Caller.Function
fileVal := fmt.Sprintf("%s:%d", entry.Caller.File, entry.Caller.Line)
Expand Down
2 changes: 1 addition & 1 deletion json_formatter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func TestFieldsInNestedDictionary(t *testing.T) {
}

// with nested object, "level" shouldn't clash
if entry["level"] != "info" {
if entry["level"] != "INFO" {
t.Errorf("Expected 'level' field to contain 'info'")
}
}
Expand Down
2 changes: 1 addition & 1 deletion level_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"encoding/json"
"testing"

"github.com/sirupsen/logrus"
"github.com/nandosuk/logrus"
"github.com/stretchr/testify/require"
)

Expand Down
Loading

0 comments on commit b8d7df0

Please sign in to comment.