Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

air-gases/logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logger

PkgGoDev

A useful gas that used to log every request for the web applications built using Air.

Installation

Open your terminal and execute

$ go get github.com/air-gases/logger

done.

The only requirement is the Go, at least v1.13.

Usage

Create a file named main.go

package main

import (
	"github.com/air-gases/logger"
	"github.com/aofei/air"
)

func main() {
	a := air.Default
	a.DebugMode = true
	a.Pregases = []air.Gas{
		logger.Gas(logger.GasConfig{}),
	}
	a.GET("/", func(req *air.Request, res *air.Response) error {
		return res.WriteString("Go and see what your terminal outputs.")
	})
	a.Serve()
}

and run it

$ go run main.go

then visit http://localhost:8080.

Community

If you want to discuss Logger, or ask questions about it, simply post questions or ideas here.

Contributing

If you want to help build Logger, simply follow this to send pull requests here.

License

This project is licensed under the MIT License.

License can be found here.