Giter Site home page Giter Site logo

logz's Introduction

logz

This library provides in-process aggregated collector of messages and web page to report them. They are useful for last mile observability of logs.

logz is inspired by OpenCensus zPages.

Build Status Coverage Status GoDevDoc time tracker Code lines Comments

Features

Screenshot

Example for go.uber.org/zap

zc := zap.NewDevelopmentConfig()
zz, lo := zzap.NewOption(logz.Config{
    MaxCardinality: 5,
    MaxSamples:     10,
	FilterMessage:  true,
})

l, err := zc.Build(zz)
if err != nil {
    panic(err)
}

l.Debug("starting example")
l.Sugar().Infow("sample info", "one", 1, "two", 2)
l.Error("unexpected end of the world")

l.Warn("please be careful with asf872dfse732")
l.Warn("please be careful with sdf890sdf0w9d") // These messages will be grouped together with help of filtering.

l.Info("starting server at http://localhost:6060/")
err = http.ListenAndServe("0.0.0.0:6060", logzpage.Handler(lo...))
if err != nil {
    l.Fatal(err.Error())
}

Example for github.com/bool64/ctxd

var logger ctxd.Logger

lz := ctxz.NewObserver(logger, logz.Config{
    MaxCardinality:      100,
    MaxSamples:          50,
    DistRetentionPeriod: 72 * time.Hour,
})
logger = lz

ctx := context.TODO()

logger.Debug(ctx, "starting example")
logger.Info(ctx, "sample info", "one", 1, "two", 2)
logger.Error(ctx, "unexpected end of the world")

logger.Important(ctx, "starting server at http://localhost:6060/")

err := http.ListenAndServe("0.0.0.0:6060", logzpage.Handler(lz.LevelObservers()...))
if err != nil {
    logger.Error(ctx, err.Error())
    os.Exit(1)
}

logz's People

Contributors

vearutop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.