default_logger.go — fiber Source File
Architecture documentation for default_logger.go, a go file in the fiber codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR bbe7abe4_a8ff_16f2_cc00_3fc20e652f9f["default_logger.go"] adf3d4e8_4d86_86c1_e6cc_281d7b4104af["fmt"] bbe7abe4_a8ff_16f2_cc00_3fc20e652f9f --> adf3d4e8_4d86_86c1_e6cc_281d7b4104af style bbe7abe4_a8ff_16f2_cc00_3fc20e652f9f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
package logger
import (
"fmt"
"io"
"os"
"strconv"
"github.com/gofiber/fiber/v3"
"github.com/gofiber/utils/v2"
"github.com/mattn/go-colorable"
"github.com/mattn/go-isatty"
"github.com/valyala/bytebufferpool"
)
// default logger for fiber
func defaultLoggerInstance(c fiber.Ctx, data *Data, cfg *Config) error {
if cfg == nil {
cfg = &Config{
Stream: os.Stdout,
Format: DefaultFormat,
enableColors: true,
}
}
// Check if Skip is defined and call it.
// Now, if Skip(c) == true, we SKIP logging:
if cfg.Skip != nil && cfg.Skip(c) {
return nil // Skip logging if Skip returns true
}
// Alias colors
colors := c.App().Config().ColorScheme
// Get new buffer
buf := bytebufferpool.Get()
// Default output when no custom Format or io.Writer is given
if cfg.Format == DefaultFormat {
// Format error if exist
formatErr := ""
if cfg.enableColors {
if data.ChainErr != nil {
formatErr = colors.Red + " | " + data.ChainErr.Error() + colors.Reset
}
fmt.Fprintf(buf,
"%s |%s %3d %s| %13v | %15s |%s %-7s %s| %-"+data.ErrPaddingStr+"s %s\n",
data.Timestamp.Load().(string), //nolint:forcetypeassert,errcheck // Timestamp is always a string
statusColor(c.Response().StatusCode(), &colors), c.Response().StatusCode(), colors.Reset,
data.Stop.Sub(data.Start),
c.IP(),
methodColor(c.Method(), &colors), c.Method(), colors.Reset,
c.Path(),
formatErr,
)
} else {
if data.ChainErr != nil {
formatErr = " | " + data.ChainErr.Error()
}
// Helper function to append fixed-width string with padding
// ... (123 more lines)
Domain
Subdomains
Classes
Dependencies
- fmt
Source
Frequently Asked Questions
What does default_logger.go do?
default_logger.go is a source file in the fiber codebase, written in go. It belongs to the FiberCore domain, Adapters subdomain.
What functions are defined in default_logger.go?
default_logger.go defines 4 function(s): appendInt, beforeHandlerFunc, defaultLoggerInstance, writeLog.
What does default_logger.go depend on?
default_logger.go imports 1 module(s): fmt.
Where is default_logger.go in the architecture?
default_logger.go is located at middleware/logger/default_logger.go (domain: FiberCore, subdomain: Adapters, directory: middleware/logger).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free