Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

jhulten/go-ctxlog

Repository files navigation

ctxlog: Extend golang context with logging GoDoc Build Status

ctxlog is a Go library extending the standard context with logging.

Features

  • Create a child context that contains a log context.
  • Helper functions to exit or panic when the provided context is cancelled.
  • Consistent API with the context standard library.

Example

package main

import (
    "context"
    "log"
    "time"
    l "github.com/jhulten/go-ctxlog"
)

func main() {
    ctx := context.Background()
    ctx = l.WithWriter(ctx, os.Stdout)
    l.PLog(ctx).Info("logged this")
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages