gogogo 一个与net / http兼容的简单Web框架

网友投稿 664 2022-10-27

gogogo 一个与net / http兼容的简单Web框架

gogogo 一个与net / http兼容的简单Web框架

gogogo

app

A simple web framework compatible with net/http.

It also has a predefined 'standard' app engine server called GoEngine accessible through helper functions Handle, Server and so on.

func A(c *Context) error { c.JSON([]byte("a")) return nil}func main() { app.Handle("/", &app.Got{A}) l, err := net.Listen("tcp", ":"+port) if err != nil { logger.Errorf("Listen: %v", err) return } app.Serve(l)}

A example site: Cyeam.

logger

A logger package that compatible with sdk log package. It supports level logging and file auto rotating.

It also has a predefined 'standard' Logger called StdLogger accessible through helper functions Debug[f], Info[f], Warn[f], Error[f], LogLevel and SetJack.

It supports 4 level:

LevelError = iotaLevelWarningLevelInformationalLevelDebug

You can use LogLevel to handle the log level.

File rotating based on package gopkg.in/natefinch/lumberjack.v2, you can control file settings by using SetJack.

Quick start

import "github.com/mnhkahn/gogogo/logger"logger.Info("hello, world.")

Defined our own logger:

l := logger.NewWriterLogger(w, flag, 3)l.Info("hello, world")

For more information, goto godoc.

Chinese details, goto link.

panicer

A help package that catch panic error and print the panic stack.

Quick start

import "github.com/mnhkahn/gogogo/panicer"func main() { defer Recover()}

For more information, goto godoc https://godoc.org/github.com/mnhkahn/gogogo/panicer

util

A util package collection.

For more information, goto godoc https://godoc.org/github.com/mnhkahn/gogogo/util

Chinese details, goto http://blog.cyeam.com//golang/2018/08/27/retry?utm_source=github

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:关于招行信用卡还款日期的几个注意问题
下一篇:SQL Server vs Oracle 简单语法比较
相关文章

 发表评论

暂时没有评论,来抢沙发吧~