Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sirupsen/logrus
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.6.0
Choose a base ref
...
head repository: sirupsen/logrus
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.9.3
Choose a head ref

Commits on Dec 9, 2019

  1. Add support for freebsd/arm64

    dmgk committed Dec 9, 2019
    Copy the full SHA
    28e2121 View commit details

Commits on Apr 10, 2020

  1. Copy the full SHA
    7d248fa View commit details

Commits on May 6, 2020

  1. Simplify checkIfTerminal for Windows

    Instead of relying on EnableVirtualTerminalProcessing from
    github.com/konsorten/go-windows-terminal-sequences which just calls
    GetConsoleMode, sets ENABLE_VIRTUAL_TERMINAL_PROCESSING and calls
    SetConsoleMode with the new modified mode, implement it directly inside
    checkIfTerminal. This also avoids the duplicate call to GetConsoleMode.
    tklauser committed May 6, 2020
    Copy the full SHA
    8665791 View commit details

Commits on May 19, 2020

  1. Merge pull request #1088 from tklauser/simplify-windows

    Simplify checkIfTerminal for Windows
    dgsb authored May 19, 2020
    Copy the full SHA
    0de04f1 View commit details
  2. Merge pull request #1077 from dmgk/master

    Add support for freebsd/arm64
    dgsb authored May 19, 2020
    Copy the full SHA
    e8fa988 View commit details
  3. Merge branch 'feature/function-log' of https://github.com/Azer0s/logrus

    … into Azer0s-feature/function-log
    dgsb committed May 19, 2020
    Copy the full SHA
    d7edea4 View commit details
  4. Copy the full SHA
    ba4da53 View commit details
  5. Merge pull request #1142 from sirupsen/function-log

    Function log
    dgsb authored May 19, 2020
    Copy the full SHA
    20dcf91 View commit details

Commits on May 26, 2020

  1. Update doc for new logger

    Update default formatter for new logger from JsonFormatter to TextFormatter
    sohel-sheikh authored May 26, 2020
    Copy the full SHA
    630ea45 View commit details
  2. Merge pull request #1144 from sohel-sheikh/patch-1

    Update doc for new logger
    dgsb authored May 26, 2020
    Copy the full SHA
    42baed8 View commit details

Commits on May 28, 2020

  1. Copy the full SHA
    64a5944 View commit details
  2. Merge pull request #1145 from sirupsen/custom_buffer_pool

    Add an API to plug a custom buffer free item mangement system
    dgsb authored May 28, 2020
    Copy the full SHA
    6699a89 View commit details

Commits on Sep 29, 2020

  1. Copy the full SHA
    c6b865f View commit details

Commits on Sep 30, 2020

  1. Merge pull request #1183 from shogo82148/update-changelog-1.7.0

    update changelog with v1.7.0
    dgsb authored Sep 30, 2020
    Copy the full SHA
    d131c24 View commit details

Commits on Oct 1, 2020

  1. Copy the full SHA
    c81a54c View commit details

Commits on Nov 6, 2020

  1. bump golang versions in travis ci

    David Bariod committed Nov 6, 2020
    Copy the full SHA
    0d28e29 View commit details
  2. bump golangci-lint version

    David Bariod committed Nov 6, 2020
    Copy the full SHA
    5819000 View commit details

Commits on Nov 8, 2020

  1. fix linter errors

    David Bariod committed Nov 8, 2020
    Copy the full SHA
    e328a4e View commit details
  2. one more linter error fixed

    David Bariod committed Nov 8, 2020
    Copy the full SHA
    89b92b9 View commit details

Commits on Nov 20, 2020

  1. Copy the full SHA
    be16a81 View commit details

Commits on Nov 21, 2020

  1. Merge pull request #1206 from l-lindsay/zosbuild

    Add build tag to enable a successful build for zos
    dgsb authored Nov 21, 2020
    Copy the full SHA
    a752a62 View commit details

Commits on Nov 24, 2020

  1. desactivate stale bot

    David Bariod committed Nov 24, 2020
    Copy the full SHA
    e3e79b6 View commit details
  2. Merge pull request #1207 from sirupsen/remove_stale_bot

    desactivate stale bot
    dgsb authored Nov 24, 2020
    Copy the full SHA
    6121f5c View commit details

Commits on Nov 26, 2020

  1. Merge pull request #1197 from sirupsen/travis_build

    bump go and golangci-lint versions in travis ci
    dgsb authored Nov 26, 2020
    Copy the full SHA
    8ae478e View commit details
  2. migrate cross build target from bash script to mage

    David Bariod committed Nov 26, 2020
    Copy the full SHA
    4b818a5 View commit details

Commits on Dec 15, 2020

  1. Remove dead panic in Entry.Panic

    [Entry.log itself panics][0] when the log level is set to PanicLevel, (and
    PanicLevel is always eneabled) so this second panic will never be reached.
    
    [0]: https://github.com/sirupsen/logrus/blob/8ae478eb8a850a54ea4915a2b572f377de1f9c7e/entry.go#L253
    alecbz committed Dec 15, 2020
    Copy the full SHA
    02fcb16 View commit details

Commits on Dec 17, 2020

  1. migrate lint script to a mage target

    David Bariod committed Dec 17, 2020
    Copy the full SHA
    b02b418 View commit details
  2. Merge pull request #1185 from CreativeCactus/patch-1

    Replace %v with %w for error
    dgsb authored Dec 17, 2020
    Copy the full SHA
    44d983d View commit details
  3. Merge pull request #1212 from alecbz/alec/remove-dead-panic

    Remove dead panic in Entry.Panic
    dgsb authored Dec 17, 2020
    Copy the full SHA
    cd4bf4e View commit details

Commits on Feb 13, 2021

  1. add a test target in the magefile

    David Bariod committed Feb 13, 2021
    Copy the full SHA
    3986c92 View commit details
  2. Merge pull request #1208 from sirupsen/magefile

    migrate ci target from bash scripts to magefile
    dgsb authored Feb 13, 2021
    Copy the full SHA
    c6da052 View commit details
  3. update travis scripts

    * bump to go 1.16
    * remove unneeded part in travis/install.sh
    David Bariod committed Feb 13, 2021
    Copy the full SHA
    6a61186 View commit details

Commits on Feb 14, 2021

  1. undo golang version bump

    David Bariod committed Feb 14, 2021
    Copy the full SHA
    003c63a View commit details
  2. Merge pull request #1228 from sirupsen/travis_upd

    update travis scripts
    dgsb authored Feb 14, 2021
    Copy the full SHA
    f513f99 View commit details

Commits on Feb 16, 2021

  1. fix for entry data field race condition

    David Bariod committed Feb 16, 2021
    Copy the full SHA
    ac6e35b View commit details
  2. Merge pull request #1229 from sirupsen/fix-data-entry-race

    fix for entry data field race condition
    dgsb authored Feb 16, 2021
    Copy the full SHA
    88d56b6 View commit details
  3. update changelog

    David Bariod committed Feb 16, 2021
    Copy the full SHA
    67c117c View commit details
  4. Merge pull request #1230 from sirupsen/new-release

    update changelog
    dgsb authored Feb 16, 2021
    Copy the full SHA
    15ca3c0 View commit details
  5. code and comments clean up

    David Bariod committed Feb 16, 2021
    Copy the full SHA
    5cb4bf6 View commit details
  6. update changelog

    David Bariod committed Feb 16, 2021
    Copy the full SHA
    35ab8d8 View commit details

Commits on Feb 17, 2021

  1. Merge pull request #1231 from sirupsen/dbd-cleanup

    cleanup
    dgsb authored Feb 17, 2021
    Copy the full SHA
    d59e561 View commit details
  2. fix race condition AddHook and traces

    David Bariod committed Feb 17, 2021
    Copy the full SHA
    d172886 View commit details

Commits on Feb 18, 2021

  1. Merge pull request #1234 from sirupsen/dbd-cleanup

    fix race condition AddHook and traces
    dgsb authored Feb 18, 2021
    Copy the full SHA
    6cff360 View commit details

Commits on Feb 19, 2021

  1. travis: run mage with -v to not discard output

    Before this:
    
        $ go run mage.go lint
        Error: running "/Users/sebastiaan/go/bin/golangci-lint run ./..." failed with exit code 1
        exit status 1
    
        $ go run mage.go test
        Error: running "go test -race -v ./..." failed with exit code 1
        exit status 1
    
    After this:
    
        $ go run mage.go -v lint
        Running target: Lint
        exec: /Users/sebastiaan/go/bin/golangci-lint run ./...
        entry.go:89:6: `iamNotUsed` is unused (deadcode)
        func iamNotUsed() {
             ^
        Error: running "/Users/sebastiaan/go/bin/golangci-lint run ./..." failed with exit code 1
        exit status 1
    
        $ go run mage.go -v test
        Running target: Test
        exec: go test -race -v ./...
        === RUN   TestRegister
        ...
        ?   	github.com/sirupsen/logrus/internal/testutils	[no test files]
        FAIL
        Error: running "go test -race -v ./..." failed with exit code 1
        exit status 1
    
    Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
    thaJeztah committed Feb 19, 2021
    Copy the full SHA
    feebf74 View commit details
  2. move "mage" to a separate module

    Move the magefile related files to a submodule, so that it
    does not become a dependency for logrus itself.
    
    Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
    thaJeztah committed Feb 19, 2021
    Copy the full SHA
    1d8091a View commit details
  3. Merge pull request #1238 from thaJeztah/move_mage

    CI: run mage with "-v" to not discard output, and move mage to a submodule
    dgsb authored Feb 19, 2021
    Copy the full SHA
    f104497 View commit details
  4. go.mod: update golang.org/x/sys to fix openbsd/mips64 on Go 1.16

    This should hopefully fix cross-compile on openbsd/mips64 on Go 1.16
    
        Building for GOOS=openbsd GOARCH=mips64
        # golang.org/x/sys/unix
        Error: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/fcntl.go:26:42: undefined: Flock_t
        Error: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/ioctl.go:26:47: undefined: Winsize
        Error: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/ioctl.go:37:47: undefined: Termios
        Error: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/ioctl.go:55:42: undefined: Winsize
        Error: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/ioctl.go:61:42: undefined: Termios
        Error: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/syscall_openbsd.go:34:6: missing function body
        Error: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/syscall_unix_gc.go:12:6: missing function body
        Error: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/syscall_unix_gc.go:13:6: missing function body
        Error: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/syscall_unix_gc.go:14:6: missing function body
        Error: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/syscall_unix_gc.go:15:6: missing function body
        Error: ../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/ioctl.go:61:42: too many errors
    
    Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
    thaJeztah committed Feb 19, 2021
    Copy the full SHA
    bdb7d4c View commit details
  5. CI: use GitHub Actions

    Use GitHub actions to run golang-ci-lint, cross, and test.
    
    The "Test()" target in Mage was a plain "go test -v ./...", and should be
    portable to other CI systems if needed; running it through the mage file
    effectively resulted in "compile a go binary to run go".
    
    The "Lint()" target in Mage relied on Travis CI setting up Golang-CI lint
    before it was executed, which required bash. Moving it to GitHub actions
    also allowed it to be run on Windows. Golang CI can still be run locally
    either through the mage file (which is kept for now), or running
    `golangci-lint run ./...` after installing golangci-lint.
    
    The "CrossBuild() Mage target is still used to perform cross-compile, as it
    contains code to generate the GOOS/GOARCH matrix, which makes it easier
    to run locally.
    
    Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
    thaJeztah committed Feb 19, 2021
    Copy the full SHA
    cbd14ed View commit details

Commits on Mar 8, 2021

  1. improve documentation about timestamp format

    David Bariod committed Mar 8, 2021
    2
    Copy the full SHA
    7a997b9 View commit details

Commits on Mar 9, 2021

  1. update changelog

    David Bariod committed Mar 9, 2021
    Copy the full SHA
    1bfef4b View commit details
Showing with 838 additions and 136 deletions.
  1. +0 −20 .github/stale.yml
  2. +61 −0 .github/workflows/ci.yaml
  3. +22 −0 .github/workflows/stale.yaml
  4. +2 −0 .gitignore
  5. +6 −8 .travis.yml
  6. +36 −0 CHANGELOG.md
  7. +8 −6 README.md
  8. +43 −0 buffer_pool.go
  9. +5 −0 ci/go.mod
  10. +2 −0 ci/go.sum
  11. +10 −0 ci/mage.go
  12. +123 −0 ci/magefile.go
  13. +55 −39 entry.go
  14. +46 −1 entry_test.go
  15. +31 −0 example_function_test.go
  16. +45 −0 exported.go
  17. +2 −4 go.mod
  18. +10 −8 go.sum
  19. +16 −0 hook_test.go
  20. +42 −0 hooks/syslog/README.md
  21. +1 −1 hooks/test/test.go
  22. +19 −0 hooks/test/test_test.go
  23. +4 −1 json_formatter.go
  24. +66 −1 logger.go
  25. +29 −1 logger_test.go
  26. +36 −3 logrus_test.go
  27. +1 −1 terminal_check_unix.go
  28. +11 −18 terminal_check_windows.go
  29. +6 −1 text_formatter.go
  30. +3 −17 travis/install.sh
  31. +0 −5 travis/lint.sh
  32. +33 −1 writer.go
  33. +64 −0 writer_test.go
20 changes: 0 additions & 20 deletions .github/stale.yml

This file was deleted.

61 changes: 61 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CI

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:

lint:
name: Golang-CI Lint
timeout-minutes: 10
strategy:
matrix:
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: golangci/golangci-lint-action@v2
with:
# must be specified without patch version
version: v1.46
cross:
name: Cross
timeout-minutes: 10
strategy:
matrix:
go-version: [1.17.x]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Cross
working-directory: ci
run: go run mage.go -v -w ../ crossBuild

test:
name: Unit test
timeout-minutes: 10
strategy:
matrix:
go-version: [1.17.x]
platform: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Test
run: go test -race -v ./...
22 changes: 22 additions & 0 deletions .github/workflows/stale.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Close inactive issues
on:
schedule:
- cron: "30 1 * * *"

jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v3
with:
days-before-issue-stale: 30
days-before-issue-close: 14
stale-issue-label: "stale"
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
days-before-pr-stale: -1
days-before-pr-close: -1
repo-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
logrus
vendor

.idea/
14 changes: 6 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -4,14 +4,12 @@ git:
depth: 1
env:
- GO111MODULE=on
go: [1.13.x, 1.14.x]
os: [linux, osx]
go: 1.15.x
os: linux
install:
- ./travis/install.sh
script:
- ./travis/cross_build.sh
- ./travis/lint.sh
- export GOMAXPROCS=4
- export GORACE=halt_on_error=1
- go test -race -v ./...
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then go test -race -v -tags appengine ./... ; fi
- cd ci
- go run mage.go -v -w ../ crossBuild
- go run mage.go -v -w ../ lint
- go run mage.go -v -w ../ test
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
# 1.8.1
Code quality:
* move magefile in its own subdir/submodule to remove magefile dependency on logrus consumer
* improve timestamp format documentation

Fixes:
* fix race condition on logger hooks


# 1.8.0

Correct versioning number replacing v1.7.1.

# 1.7.1

Beware this release has introduced a new public API and its semver is therefore incorrect.

Code quality:
* use go 1.15 in travis
* use magefile as task runner

Fixes:
* small fixes about new go 1.13 error formatting system
* Fix for long time race condiction with mutating data hooks

Features:
* build support for zos

# 1.7.0
Fixes:
* the dependency toward a windows terminal library has been removed

Features:
* a new buffer pool management API has been added
* a set of `<LogLevel>Fn()` functions have been added

# 1.6.0
Fixes:
* end of line cleanup
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Logrus <img src="http://i.imgur.com/hTeVwmJ.png" width="40" height="40" alt=":walrus:" class="emoji" title=":walrus:"/> [![Build Status](https://travis-ci.org/sirupsen/logrus.svg?branch=master)](https://travis-ci.org/sirupsen/logrus) [![GoDoc](https://godoc.org/github.com/sirupsen/logrus?status.svg)](https://godoc.org/github.com/sirupsen/logrus)
# Logrus <img src="http://i.imgur.com/hTeVwmJ.png" width="40" height="40" alt=":walrus:" class="emoji" title=":walrus:"/> [![Build Status](https://github.com/sirupsen/logrus/workflows/CI/badge.svg)](https://github.com/sirupsen/logrus/actions?query=workflow%3ACI) [![Build Status](https://travis-ci.org/sirupsen/logrus.svg?branch=master)](https://travis-ci.org/sirupsen/logrus) [![Go Reference](https://pkg.go.dev/badge/github.com/sirupsen/logrus.svg)](https://pkg.go.dev/github.com/sirupsen/logrus)

Logrus is a structured logger for Go (golang), completely API compatible with
the standard library logger.
@@ -9,7 +9,7 @@ the last thing you want from your Logging library (again...).

This does not mean Logrus is dead. Logrus will continue to be maintained for
security, (backwards compatible) bug fixes, and performance (where we are
limited by the interface).
limited by the interface).

I believe Logrus' biggest contribution is to have played a part in today's
widespread use of structured logging in Golang. There doesn't seem to be a
@@ -43,7 +43,7 @@ plain text):
With `log.SetFormatter(&log.JSONFormatter{})`, for easy parsing by logstash
or Splunk:

```json
```text
{"animal":"walrus","level":"info","msg":"A group of walrus emerges from the
ocean","size":10,"time":"2014-03-10 19:57:38.562264131 -0400 EDT"}
@@ -99,7 +99,7 @@ time="2015-03-26T01:27:38-04:00" level=fatal method=github.com/sirupsen/arcticcr
```
Note that this does add measurable overhead - the cost will depend on the version of Go, but is
between 20 and 40% in recent tests with 1.6 and 1.7. You can validate this in your
environment via benchmarks:
environment via benchmarks:
```
go test -bench=.*CallerTracing
```
@@ -317,6 +317,8 @@ log.SetLevel(log.InfoLevel)
It may be useful to set `log.Level = logrus.DebugLevel` in a debug or verbose
environment if your application has that.

Note: If you want different log levels for global (`log.SetLevel(...)`) and syslog logging, please check the [syslog hook README](hooks/syslog/README.md#different-log-levels-for-local-and-remote-logging).

#### Entries

Besides the fields added with `WithField` or `WithFields` some fields are
@@ -341,7 +343,7 @@ import (
log "github.com/sirupsen/logrus"
)

init() {
func init() {
// do something here to set environment depending on an environment variable
// or command-line flag
if Environment == "production" {
@@ -402,7 +404,7 @@ func (f *MyJSONFormatter) Format(entry *Entry) ([]byte, error) {
// source of the official loggers.
serialized, err := json.Marshal(entry.Data)
if err != nil {
return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err)
return nil, fmt.Errorf("Failed to marshal fields to JSON, %w", err)
}
return append(serialized, '\n'), nil
}
43 changes: 43 additions & 0 deletions buffer_pool.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package logrus

import (
"bytes"
"sync"
)

var (
bufferPool BufferPool
)

type BufferPool interface {
Put(*bytes.Buffer)
Get() *bytes.Buffer
}

type defaultPool struct {
pool *sync.Pool
}

func (p *defaultPool) Put(buf *bytes.Buffer) {
p.pool.Put(buf)
}

func (p *defaultPool) Get() *bytes.Buffer {
return p.pool.Get().(*bytes.Buffer)
}

// SetBufferPool allows to replace the default logrus buffer pool
// to better meets the specific needs of an application.
func SetBufferPool(bp BufferPool) {
bufferPool = bp
}

func init() {
SetBufferPool(&defaultPool{
pool: &sync.Pool{
New: func() interface{} {
return new(bytes.Buffer)
},
},
})
}
5 changes: 5 additions & 0 deletions ci/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/sirupsen/logrus/ci

go 1.15

require github.com/magefile/mage v1.11.0
2 changes: 2 additions & 0 deletions ci/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/magefile/mage v1.11.0 h1:C/55Ywp9BpgVVclD3lRnSYCwXTYxmSppIgLeDYlNuls=
github.com/magefile/mage v1.11.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
10 changes: 10 additions & 0 deletions ci/mage.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// +build ignore

package main

import (
"github.com/magefile/mage/mage"
"os"
)

func main() { os.Exit(mage.Main()) }
Loading