Skip to content

twopow/glog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

glog

A simple slog wrapper with Google Cloud Logging support.

Features

  • Structured JSON logging compatible with Google Cloud Logging
  • slog-based API with context support
  • Automatic source location for debug and error levels
  • Global extra fields support

Usage

import "github.com/twopow/glog"

// Initialize logger - sets the default logger
logger := glog.NewLogger("info")

// Use package-level functions (default logger)
glog.Info("application started")
glog.Error("something went wrong", "error", err)

// Or use the returned logger directly
logger.Info("using logger directly")

// With context
ctx := glog.WithLogger(context.Background(), logger)
glog.InfoContext(ctx, "handling request", "method", "GET")

Installation

go get github.com/twopow/glog

License

MIT

About

slog wrapper for GCP logging

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages