-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
74 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"global": { | ||
"exclude": "G204,G302,G303,G304,G306,G404,G402" | ||
"exclude": "" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,49 @@ | ||
# Go K8s | ||
# Fiber Middleware for charmbracelet/log | ||
|
||
A K8s collection of Go Packages. | ||
A GoFiber middleware for Charmlog logger. | ||
|
||
[![tag](https://img.shields.io/github/tag/zcubbs/go-k8s)](https://github.com/zcubbs/go-k8s/releases) | ||
- Fiber: https://github.com/gofiber/fiber | ||
- charmbracelet/log: https://github.com/charmbracelet/log | ||
|
||
[![tag](https://img.shields.io/github/tag/zcubbs/charmlogfiber)](https://github.com/zcubbs/charmlogfiber/releases) | ||
![Go Version](https://img.shields.io/badge/Go-%3E%3D%201.21-%23007d9c) | ||
[![GoDoc](https://godoc.org/github.com/zcubbs/go-k8s?status.svg)](https://pkg.go.dev/github.com/zcubbs/go-k8s) | ||
[![Lint](https://github.com/zcubbs/go-k8s/actions/workflows/lint.yaml/badge.svg)](https://github.com/zcubbs/go-k8s/actions/workflows/lint.yaml) | ||
[![Scan](https://github.com/zcubbs/go-k8s/actions/workflows/scan.yaml/badge.svg?branch=main)](https://github.com/zcubbs/go-k8s/actions/workflows/scan.yaml) | ||
![Build Status](https://github.com/zcubbs/go-k8s/actions/workflows/test.yaml/badge.svg) | ||
[![Go Report Card](https://goreportcard.com/badge/github.com/zcubbs/go-k8s)](https://goreportcard.com/report/github.com/zcubbs/go-k8s) | ||
[![Contributors](https://img.shields.io/github/contributors/zcubbs/go-k8s)](https://github.com/zcubbs/go-k8s/graphs/contributors) | ||
[![License](https://img.shields.io/github/license/zcubbs/go-k8s.svg)](./LICENSE) | ||
[![GoDoc](https://godoc.org/github.com/zcubbs/charmlogfiber?status.svg)](https://pkg.go.dev/github.com/zcubbs/charmlogfiber) | ||
[![Lint](https://github.com/zcubbs/charmlogfiber/actions/workflows/lint.yaml/badge.svg)](https://github.com/zcubbs/charmlogfiber/actions/workflows/lint.yaml) | ||
[![Scan](https://github.com/zcubbs/charmlogfiber/actions/workflows/scan.yaml/badge.svg?branch=main)](https://github.com/zcubbs/charmlogfiber/actions/workflows/scan.yaml) | ||
![Build Status](https://github.com/zcubbs/charmlogfiber/actions/workflows/test.yaml/badge.svg) | ||
[![Go Report Card](https://goreportcard.com/badge/github.com/zcubbs/charmlogfiber)](https://goreportcard.com/report/github.com/zcubbs/charmlogfiber) | ||
[![Contributors](https://img.shields.io/github/contributors/zcubbs/charmlogfiber)](https://github.com/zcubbs/charmlogfiber/graphs/contributors) | ||
[![License](https://img.shields.io/github/license/zcubbs/charmlogfiber.svg)](./LICENSE) | ||
|
||
## Usage | ||
|
||
```go | ||
package main | ||
|
||
import ( | ||
"github.com/gofiber/fiber/v2" | ||
"github.com/charmbracelet/log" | ||
"github.com/zcubbs/charmlogfiber" | ||
"os" | ||
) | ||
|
||
func main() { | ||
app := fiber.New() | ||
|
||
logger := log.New(os.Stderr) | ||
// Create a new logger | ||
fiberLogger := charmlogfiber.New(logger) | ||
|
||
// Use the logger in the Fiber app | ||
app.Use(fiberLogger) | ||
|
||
app.Get("/", func(c *fiber.Ctx) error { | ||
// Log a message | ||
logger.Info("Hello, World!") | ||
|
||
return c.SendString("Hello, World!") | ||
}) | ||
|
||
app.Listen(":3000") | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,28 @@ | ||
module charmlogfiber | ||
|
||
go 1.21 | ||
|
||
require ( | ||
github.com/charmbracelet/log v0.2.5 | ||
github.com/gofiber/fiber/v2 v2.49.2 | ||
github.com/google/uuid v1.3.1 | ||
) | ||
|
||
require ( | ||
github.com/andybalholm/brotli v1.0.5 // indirect | ||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect | ||
github.com/charmbracelet/lipgloss v0.8.0 // indirect | ||
github.com/go-logfmt/logfmt v0.6.0 // indirect | ||
github.com/klauspost/compress v1.16.7 // indirect | ||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect | ||
github.com/mattn/go-colorable v0.1.13 // indirect | ||
github.com/mattn/go-isatty v0.0.19 // indirect | ||
github.com/mattn/go-runewidth v0.0.15 // indirect | ||
github.com/muesli/reflow v0.3.0 // indirect | ||
github.com/muesli/termenv v0.15.2 // indirect | ||
github.com/rivo/uniseg v0.2.0 // indirect | ||
github.com/valyala/bytebufferpool v1.0.0 // indirect | ||
github.com/valyala/fasthttp v1.49.0 // indirect | ||
github.com/valyala/tcplisten v1.0.0 // indirect | ||
golang.org/x/sys v0.12.0 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters