Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/sirupsen/logrus
/ functions
Functions
506 in github.com/sirupsen/logrus
⨍
Functions
506
◇
Types & classes
58
↓ 64 callers
Function
New
New Creates a new logger. Configuration should be set by changing [Formatter], Out and Hooks directly on the default Logger instance. You can also jus
logger.go:96
↓ 59 callers
Method
Info
(args ...any)
logrus.go:194
↓ 41 callers
Method
SetOutput
SetOutput sets the logger output.
logger.go:448
↓ 34 callers
Method
Errorf
(format string, args ...any)
logrus.go:209
↓ 30 callers
Method
Error
(args ...any)
logrus.go:208
↓ 30 callers
Method
Fatal
(args ...any)
logrus.go:155
↓ 28 callers
Method
WithField
(key string, value any)
logrus.go:167
↓ 26 callers
Method
String
String returns the string representation from the reader and ultimately the formatter.
entry.go:150
↓ 24 callers
Function
LogAndAssertJSON
(t *testing.T, log func(*logrus.Logger), assertions func(logrus.Fields))
internal/testutils/testutils.go:15
↓ 23 callers
Method
Add
Add a hook to an instance of logger. This is called with `log.Hooks.Add(new(MyHook))` where `MyHook` implements the `Hook` interface.
hooks.go:18
↓ 19 callers
Function
NewEntry
NewEntry creates a new [Entry] associated with the provided Logger. The logger must not be nil. Passing a nil logger results in a panic when a logging
entry.go:100
↓ 19 callers
Method
SetLevel
SetLevel sets the logger level.
logger.go:404
↓ 18 callers
Method
AddHook
AddHook adds a hook to the logger hooks.
logger.go:414
↓ 18 callers
Method
IsLevelEnabled
IsLevelEnabled checks if logging for the given level is enabled.
logger.go:436
↓ 18 callers
Function
WithField
WithField creates an entry from the standard logger and adds a single field. For multiple fields, prefer [WithFields] over chaining WithField calls.
exported.go:68
↓ 17 callers
Method
Format
Format renders a single log entry
json_formatter.go:70
↓ 17 callers
Method
Log
Log logs a message at the specified level. Using Log with [PanicLevel] or [FatalLevel] intentionally does not trigger a panic or exit. Log treats the
entry.go:417
↓ 17 callers
Function
NewNullLogger
NewNullLogger creates a discarding logger and installs the test hook.
hooks/test/test.go:40
↓ 17 callers
Method
newEntry
()
logger.go:107
↓ 17 callers
Method
releaseEntry
(entry *Entry)
logger.go:115
↓ 16 callers
Method
SetFormatter
SetFormatter sets the logger formatter.
logger.go:441
↓ 15 callers
Method
Fatalf
(format string, args ...any)
logrus.go:156
↓ 15 callers
Method
Lock
()
logger.go:68
↓ 15 callers
Method
Unlock
()
logger.go:74
↓ 14 callers
Method
LastEntry
LastEntry returns the last entry that was logged or nil.
hooks/test/test.go:59
↓ 14 callers
Function
doBenchmark
(b *testing.B, formatter logrus.Formatter, fields logrus.Fields)
formatter_bench_test.go:144
↓ 13 callers
Method
Bytes
Bytes returns the bytes representation of this entry from the formatter.
entry.go:131
↓ 12 callers
Method
Format
Format renders a single log entry
text_formatter.go:146
↓ 11 callers
Method
Print
(args ...any)
logrus.go:151
↓ 10 callers
Method
Warn
(args ...any)
logrus.go:201
↓ 10 callers
Method
WithFields
(fields Fields)
logrus.go:168
↓ 9 callers
Method
Exit
(code int)
logger.go:384
↓ 9 callers
Method
Format
(*Entry)
formatter.go:40
↓ 9 callers
Method
Logf
Entry Printf family functions Logf logs a formatted message at the specified level. Using Logf with [PanicLevel] or [FatalLevel] intentionally does n
entry.go:471
↓ 9 callers
Method
Logln
Entry Println family functions Logln logs a message at the specified level with Println-style spacing. Using Logln with [PanicLevel] or [FatalLevel]
entry.go:525
↓ 7 callers
Method
Log
Log logs a message at the specified level. Using Log with [PanicLevel] or [FatalLevel] intentionally does not trigger a panic or exit. Log treats the
logger.go:221
↓ 7 callers
Method
LogFn
LogFn logs a message returned by fn at the specified level. Using LogFn with [PanicLevel] or [FatalLevel] intentionally does not trigger a panic or e
logger.go:234
↓ 7 callers
Method
SetReportCaller
SetReportCaller sets whether the caller stack frame must be logged.
logger.go:455
↓ 7 callers
Method
WithTime
WithTime overrides the time of the Entry.
entry.go:229
↓ 7 callers
Method
Write
(p []byte)
writer_test.go:50
↓ 7 callers
Method
dup
dup copies the entry fields shared by derived entries except Data, which callers must copy or initialize as appropriate for their use.
entry.go:120
↓ 6 callers
Method
Level
()
hooks/slog/level.go:29
↓ 6 callers
Method
Logf
Logf logs a formatted message at the specified level. Using Logf with [PanicLevel] or [FatalLevel] intentionally does not trigger a panic or exit. Lo
logger.go:165
↓ 6 callers
Method
Logln
Logln logs a message at the specified level with Println-style spacing. Using Logln with [PanicLevel] or [FatalLevel] intentionally does not trigger
logger.go:333
↓ 6 callers
Method
Reset
Reset removes all Entries from this test hook.
hooks/test/test.go:83
↓ 6 callers
Method
log
log writes msg at level. If panicAfter is true, it panics with the fully populated entry after hooks and output have completed. The explicit flag kee
entry.go:327
↓ 6 callers
Function
skipReportCaller
(t *testing.T)
logrus_test.go:22
↓ 5 callers
Method
Info
(args ...any)
entry.go:436
↓ 5 callers
Method
Infoln
(args ...any)
logrus.go:196
↓ 5 callers
Method
Panic
(args ...any)
logrus.go:159
↓ 5 callers
Method
WithContext
WithContext adds a context to the Entry.
entry.go:174
↓ 4 callers
Method
AllEntries
AllEntries returns all entries that were logged.
hooks/test/test.go:70
↓ 4 callers
Method
Debug
(args ...any)
logrus.go:187
↓ 4 callers
Method
Handle
Handle converts the slog record into a logrus entry and logs it. Record time, context, message, and attributes (including those from [Handler.WithAttr
hooks/slog/handler.go:88
↓ 4 callers
Method
ReplaceHooks
ReplaceHooks replaces the logger hooks and returns the old ones
logger.go:462
↓ 4 callers
Method
WithField
WithField adds a single field to the Entry.
entry.go:182
↓ 4 callers
Method
Writer
Writer returns an io.Writer that writes to the logger at the info log level
writer.go:25
↓ 3 callers
Function
Exit
Exit runs all the Logrus atexit handlers and then terminates the program using os.Exit(code)
alt_exit.go:49
↓ 3 callers
Method
Get
()
buffer_pool.go:18
↓ 3 callers
Method
Panicf
(format string, args ...any)
logrus.go:160
↓ 3 callers
Method
Panicln
(args ...any)
logrus.go:161
↓ 3 callers
Method
Println
(args ...any)
logrus.go:153
↓ 3 callers
Method
Put
(*bytes.Buffer)
buffer_pool.go:17
↓ 3 callers
Function
StandardLogger
StandardLogger returns the package-level standard logger used by the top-level logging functions.
exported.go:15
↓ 3 callers
Method
WithError
WithError adds an error as single field (using the key defined in [ErrorKey]) to the Entry.
entry.go:161
↓ 3 callers
Method
WithFields
WithFields adds a map of fields to the Entry.
entry.go:201
↓ 3 callers
Method
WriterLevel
WriterLevel returns an io.Writer that writes to the logger at the given log level
writer.go:30
↓ 3 callers
Function
assertFileContent
(t *testing.T, path, want string, childOut []byte)
alt_exit_test.go:112
↓ 3 callers
Function
reexecCommand
reexecCommand builds a command that execs the current test binary (exe) with argv0 set to token and "-test.run=<pattern>" so the child runs only this
alt_exit_test.go:157
↓ 3 callers
Function
reexecTest
reexecTest runs fn if this process is the child (argv0 == token). Returns true in the child (caller should return).
alt_exit_test.go:135
↓ 3 callers
Method
resolve
(key fieldKey)
json_formatter.go:16
↓ 2 callers
Method
ErrorFn
(fn LogFunction)
logger.go:311
↓ 2 callers
Method
Fire
(*Entry)
hooks.go:10
↓ 2 callers
Method
GetLevel
GetLevel returns the logger level.
logger.go:409
↓ 2 callers
Method
InfoFn
(fn LogFunction)
logger.go:293
↓ 2 callers
Method
Infof
(format string, args ...any)
logrus.go:195
↓ 2 callers
Function
LogAndAssertText
(t *testing.T, log func(*logrus.Logger), assertions func(fields map[string]string))
internal/testutils/testutils.go:30
↓ 2 callers
Function
NewGlobal
NewGlobal installs a test hook for the global logger.
hooks/test/test.go:24
↓ 2 callers
Function
NewLocal
NewLocal installs a test hook for a given local logger.
hooks/test/test.go:32
↓ 2 callers
Method
Printf
(format string, args ...any)
logrus.go:152
↓ 2 callers
Function
RegisterExitHandler
RegisterExitHandler appends a Logrus Exit handler to the list of handlers, call logrus.Exit to invoke all handlers. The handlers will also be invoked
alt_exit.go:62
↓ 2 callers
Method
SetBufferPool
SetBufferPool sets the logger buffer pool.
logger.go:471
↓ 2 callers
Function
SetReportCaller
SetReportCaller sets whether the standard logger will include the calling method as a field.
exported.go:31
↓ 2 callers
Method
String
Convert the Level to a string. E.g. [PanicLevel] becomes "panic".
logrus.go:18
↓ 2 callers
Method
String
()
writer_test.go:62
↓ 2 callers
Method
Trace
(args ...any)
logrus.go:215
↓ 2 callers
Method
UnmarshalText
UnmarshalText implements encoding.TextUnmarshaler.
logrus.go:67
↓ 2 callers
Method
WarnFn
(fn LogFunction)
logger.go:303
↓ 2 callers
Method
Warning
Legacy warning aliases. These are kept on FieldLogger for backwards compatibility, but are intentionally omitted from [WarnLogger].
logrus.go:180
↓ 2 callers
Method
WithError
(err error)
logrus.go:169
↓ 2 callers
Function
WithFields
WithFields creates an entry from the standard logger and adds the fields to it.
exported.go:73
↓ 2 callers
Method
WithFields
WithFields adds a struct of fields to the log entry. It calls [Entry.WithField] for each Field.
logger.go:132
↓ 2 callers
Method
WithGroup
WithGroup returns a new Handler with a group appended to the receiver's existing groups. All attributes added to the returned handler (via WithAttrs o
hooks/slog/handler.go:151
↓ 2 callers
Function
appendAttr
appendAttr adds attr to fields, resolving it and applying group prefixes. Group attributes are flattened with "."-separated keys.
hooks/slog/handler.go:173
↓ 2 callers
Function
appendLine
(path, s string)
alt_exit_test.go:99
↓ 2 callers
Method
appendValue
(b *bytes.Buffer, value any)
text_formatter.go:318
↓ 2 callers
Function
argv0Token
argv0Token computes a short deterministic token for (t.Name(), name).
alt_exit_test.go:128
↓ 2 callers
Function
benchmarkEntryInfo
(b *testing.B, reportCaller bool)
entry_bench_test.go:97
↓ 2 callers
Function
benchmarkEntryReportCallerDepth4
benchmarkEntryReportCallerDepth4 simulates a wrapper call site. It does not increase getCaller() scan depth (which stops at the first non-logrus frame
entry_bench_test.go:138
↓ 2 callers
Function
checkIfTerminal
(w io.Writer)
terminal_check_windows.go:12
next →
1–100 of 506, ranked by callers