Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions alt_exit_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package logrus

import (
"io/ioutil"
"log"
"os"
"os/exec"
Expand Down Expand Up @@ -76,14 +75,14 @@ func TestHandler(t *testing.T) {
testprog := testprogleader
testprog = append(testprog, getPackage()...)
testprog = append(testprog, testprogtrailer...)
tempDir, err := ioutil.TempDir("", "test_handler")
tempDir, err := os.MkdirTemp("", "test_handler")
if err != nil {
log.Fatalf("can't create temp dir. %q", err)
}
defer os.RemoveAll(tempDir)

gofile := filepath.Join(tempDir, "gofile.go")
if err := ioutil.WriteFile(gofile, testprog, 0666); err != nil {
if err := os.WriteFile(gofile, testprog, 0666); err != nil {
t.Fatalf("can't create go file. %q", err)
}

Expand All @@ -94,7 +93,7 @@ func TestHandler(t *testing.T) {
t.Fatalf("completed normally, should have failed")
}

data, err := ioutil.ReadFile(outfile)
data, err := os.ReadFile(outfile)
if err != nil {
t.Fatalf("can't read output file %s. %q", outfile, err)
}
Expand Down
4 changes: 2 additions & 2 deletions hooks/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package test

import (
"io/ioutil"
"io"
"sync"

"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -42,7 +42,7 @@ func NewLocal(logger *logrus.Logger) *Hook {
func NewNullLogger() (*logrus.Logger, *Hook) {

logger := logrus.New()
logger.Out = ioutil.Discard
logger.Out = io.Discard

return logger, NewLocal(logger)

Expand Down
4 changes: 2 additions & 2 deletions hooks/writer/writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package writer

import (
"bytes"
"io/ioutil"
"io"
"testing"

log "github.com/sirupsen/logrus"
Expand All @@ -16,7 +16,7 @@ func TestDifferentLevelsGoToDifferentWriters(t *testing.T) {
DisableTimestamp: true,
DisableColors: true,
})
log.SetOutput(ioutil.Discard) // Send all logs to nowhere by default
log.SetOutput(io.Discard) // Send all logs to nowhere by default

log.AddHook(&Hook{
Writer: &a,
Expand Down
4 changes: 2 additions & 2 deletions logger_bench_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package logrus

import (
"io/ioutil"
"io"
"os"
"testing"
)
Expand Down Expand Up @@ -65,7 +65,7 @@ func doLoggerBenchmarkWithFormatter(b *testing.B, f Formatter) {
b.SetParallelism(100)
log := New()
log.Formatter = f
log.Out = ioutil.Discard
log.Out = io.Discard
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
log.
Expand Down
6 changes: 3 additions & 3 deletions logrus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"os"
"path/filepath"
"runtime"
Expand Down Expand Up @@ -636,7 +636,7 @@ func TestReplaceHooks(t *testing.T) {
old, cur := &TestHook{}, &TestHook{}

logger := New()
logger.SetOutput(ioutil.Discard)
logger.SetOutput(io.Discard)
logger.AddHook(old)

hooks := make(LevelHooks)
Expand Down Expand Up @@ -781,7 +781,7 @@ func TestReportCallerOnTextFormatter(t *testing.T) {

func TestSetReportCallerRace(t *testing.T) {
l := New()
l.Out = ioutil.Discard
l.Out = io.Discard
l.SetReportCaller(true)

var wg sync.WaitGroup
Expand Down
Loading