Home / File/ logger.go — gin Source File

logger.go — gin Source File

Architecture documentation for logger.go, a go file in the gin codebase. 1 imports, 0 dependents.

File go GinCore Middleware 1 imports 10 functions 4 classes

Entity Profile

Dependency Diagram

graph LR
  ed464f46_6294_af3d_9831_5646cd0d38c7["logger.go"]
  e8c9ceab_299a_1e0e_919f_ddb404deb199["fmt"]
  ed464f46_6294_af3d_9831_5646cd0d38c7 --> e8c9ceab_299a_1e0e_919f_ddb404deb199
  style ed464f46_6294_af3d_9831_5646cd0d38c7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// Copyright 2014 Manu Martinez-Almeida. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.

package gin

import (
	"fmt"
	"io"
	"net/http"
	"os"
	"time"

	"github.com/mattn/go-isatty"
)

type consoleColorModeValue int

const (
	autoColor consoleColorModeValue = iota
	disableColor
	forceColor
)

const (
	green   = "\033[97;42m"
	white   = "\033[90;47m"
	yellow  = "\033[90;43m"
	red     = "\033[97;41m"
	blue    = "\033[97;44m"
	magenta = "\033[97;45m"
	cyan    = "\033[97;46m"
	reset   = "\033[0m"
)

var consoleColorMode = autoColor

// LoggerConfig defines the config for Logger middleware.
type LoggerConfig struct {
	// Optional. Default value is gin.defaultLogFormatter
	Formatter LogFormatter

	// Output is a writer where logs are written.
	// Optional. Default value is gin.DefaultWriter.
	Output io.Writer

	// SkipPaths is a URL path array which logs are not written.
	// Optional.
	SkipPaths []string

	// Skip is a Skipper that indicates which logs should not be written.
	// Optional.
	Skip Skipper
}

// Skipper is a function to skip logs based on provided Context
type Skipper func(c *Context) bool

// LogFormatter gives the signature of the formatter function passed to LoggerWithFormatter
type LogFormatter func(params LogFormatterParams) string
// ... (250 more lines)

Domain

Subdomains

Dependencies

  • fmt

Frequently Asked Questions

What does logger.go do?
logger.go is a source file in the gin codebase, written in go. It belongs to the GinCore domain, Middleware subdomain.
What functions are defined in logger.go?
logger.go defines 10 function(s): DisableConsoleColor, ErrorLogger, ErrorLoggerT, ForceConsoleColor, Logger, LoggerWithConfig, LoggerWithFormatter, LoggerWithWriter, bool, string.
What does logger.go depend on?
logger.go imports 1 module(s): fmt.
Where is logger.go in the architecture?
logger.go is located at logger.go (domain: GinCore, subdomain: Middleware).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free