judaslogger

package module
v0.0.0-...-6f2be39 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2020 License: MIT Imports: 7 Imported by: 0

README

judas-logger

logger gin+zap customize

Usage

Start using it

Download and install it:

$ go get github.com/judascrow/judaslogger

Import it in your code:

import "github.com/judascrow/judaslogger"

Example

See the example.

package main

import (
	"net/http"

	"github.com/gin-gonic/gin"
	"github.com/judascrow/judaslogger"
)

func main() {
	r := gin.New()

	timeFormat := "2006-01-02 15:04:05"
	r.Use(judaslogger.JudasLoggerZap(timeFormat))

	// Example ping request.
	r.GET("/test", func(c *gin.Context) {
		c.JSON(http.StatusOK, gin.H{
			"success": true,
			"message": "API is Online",
		})
	})

	// Listen and Server in 0.0.0.0:8080
	r.Run(":8080")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseLogFile

func CloseLogFile()

func JudasLoggerZap

func JudasLoggerZap(timeFormat string) gin.HandlerFunc

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL