MCPcopy
hub / github.com/sirupsen/logrus / New

Function New

logger.go:87–96  ·  logger.go::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 just instantiate your own: var log = &logrus.Logger{ Out: os.Stderr, Formatter: new(logrus.TextFormatter), Hooks: make(logrus.LevelH

()

Source from the content-addressed store, hash-verified

85//
86// It's recommended to make this a global instance called `log`.
87func New() *Logger {
88 return &Logger{
89 Out: os.Stderr,
90 Formatter: new(TextFormatter),
91 Hooks: make(LevelHooks),
92 Level: InfoLevel,
93 ExitFunc: os.Exit,
94 ReportCaller: false,
95 }
96}
97
98func (logger *Logger) newEntry() *Entry {
99 entry, ok := logger.entryPool.Get().(*Entry)

Callers 15

ExampleDefaultFieldHookFunction · 0.92
Example_hookFunction · 0.92
ExampleGlobalHookFunction · 0.92
Example_basicFunction · 0.92
TestWriterSplitNewlinesFunction · 0.92
TestWriterSplitsMax64KBFunction · 0.92
NewNullLoggerFunction · 0.92
TestNewLocalFunction · 0.92
TestLocalhostAddAndPrintFunction · 0.92

Calls

no outgoing calls

Tested by 15

ExampleDefaultFieldHookFunction · 0.74
Example_hookFunction · 0.74
ExampleGlobalHookFunction · 0.74
Example_basicFunction · 0.74
TestWriterSplitNewlinesFunction · 0.74
TestWriterSplitsMax64KBFunction · 0.74
TestNewLocalFunction · 0.74
TestLocalhostAddAndPrintFunction · 0.74
TestEntryWithErrorFunction · 0.68