gologger

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2022 License: MIT Imports: 4 Imported by: 0

README

gologger

json formatted logger for gofiber framework

Usage

package main

import (
	"github.com/gofiber/fiber"
	"github.com/vasuvanka/gologger"
)

func main() {
	app := fiber.New()

	app.Use(gologger.Log)
	
	app.Get("/", func(c *fiber.Ctx) {
		c.Send("Hello, World 👋!")
	})

	app.Listen(3000)
}

License

MIT

Free Software

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Log

func Log(ctx *fiber.Ctx)

Log - logger will print JSON formatted logs onto STDOUT

Types

type LogStruct

type LogStruct struct {
	IP        string `json:"ip"`
	URL       string `json:"url"`
	StartTime string `json:"start_time"`
	EndTime   string `json:"end_time"`
	Duration  int64  `json:"duration"`
	Agent     string `json:"agent"`
	Status    int    `json:"status"`
	Method    string `json:"method"`
}

LogStruct - logger structure

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳