Giter Club home page Giter Club logo

zapz's Introduction

Zapz: Uber's Zap --> logzio

Zapz creates a zap.Logger that sends logs to logzio. This creates a custom WriterSync that buffers data on disk and drains every 5 seconds.

Zapz uses logzio-go to transport logs via HTTP

GoDoc Build Status Coverage Status Go Report

Installation

$ go get -u github.com/dougEfresh/zapz

Quick Start

package main

import (
 "os"

 "github.com/dougEfresh/zapz"
   )

func main() {
 l, err := zapz.New(os.Args[1]) //logzio token required
 if err != nil {
   panic(err)
 }

 l.Info("tester")
 // Logs are buffered on disk, this will flush it
 if l.Sync() != nil {
     panic("oops")
 }
}

Getting Started

Get Logzio token

  1. Go to Logzio website
  2. Sign in with your Logzio account
  3. Click the top menu gear icon (Account)
  4. The Logzio token is given in the account page

Usage

Set Debug level: zapz.New(token, zapz.SetLevel(zapcore.DebugLevel))

Set CustomEncoder config: zapz.New(token, zapz.SetEncodeConfig(cfg))

Set Custom log type:

A type field is created by default: zap.String("type", "zap-logger"). You can change it like so zapz.New(token, zapz.SetType(logzType))

Examples

passwd-pot

lambdazap

Prerequisites

go 1.x

Tests

$ go test -v

Contributing

All PRs are welcome

Authors

License

This project is licensed under the Apache License - see the LICENSE file for details

Acknowledgments

logz java

TODO

zapz's People

Contributors

dougefresh avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

zapz's Issues

zap does not logs error on logz.io

Hey,
I am using zapz with gin framework for logging on logz.io and this is a demo code :

func main() {
	r := gin.New()

	r.Use(gin.Recovery())

	logger, err := zapz.New("token")

	if err != nil {
		panic(err)
	}

		logger.Info("A")
		logger.Info("B")
	
	
	r.GET("/ping1", func(c *gin.Context) {
		logger.Info("C")
		c.String(200, "pong1 "+fmt.Sprint(time.Now().Unix()))
		return
	})

	r.GET("/ping2", func(c *gin.Context) {
		logger.Info("D")
		c.String(200, "pong2 "+fmt.Sprint(time.Now().Unix()))
	})

	r.Run(":8080")
 }

So here A and B will be logged on logz.io but not C & D.
Is there anything that I am missing in here ?

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.