utils

package module
v0.0.0-...-68fe245 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2016 License: Apache-2.0 Imports: 4 Imported by: 2

README

Macaron-utils

GoDoc

Utility methods for go-macaron.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultJSON

func DefaultJSON() macaron.Handler

DefaultJSON creates a handler that sets the request Content-Type to `application/json` if it was not set before and the method is either POST or PUT.

func Logger

func Logger(log *logging.Logger, options ...LoggerOption) macaron.Handler

Logger creates a handler that logs the current request.

func Ping

func Ping() macaron.Handler

Ping creates a handler that returns an OK response.

func ServerInfo

func ServerInfo(projectName, projectVersion, projectBuild string) macaron.Handler

ServerInfo creates a handler that sets returns a text formatted version info.

Types

type LoggerOption

type LoggerOption func(ctx *macaron.Context) bool

LoggerOption is used to control the logging process

func DontLog

func DontLog(method string, paths ...string) LoggerOption

DontLog avoids a log message when the request matches the given method. If you path Path's, log messages are only avoided when one of the path's matches.

func DontLogHead

func DontLogHead() LoggerOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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