Giter VIP home page Giter VIP logo

events's Issues

Making the http access logs debug logs

@f2prateek
@yields
@abraithwaite

I feel like in every project where I've used this package I never wanted to have the access http access logs how up by default, which resulted in code that looked like this:

if debug {
  handler = httpevents.NewHandler(handler)
}

What would you guys think about making the access logs debug logs by default?

Intercept frequently used attributes like trace id, workspace id

Most of the time while designing the web application, we repeatedly log things like x-trace-id, request-id. Specific to segment's use-case WorkspaceID is also one mostly being logged.

Wouldn't that be a good idea to expose middleware like API to intercept the logger where we can add such repeatedly used attributes.

Inspired by: morgan

Request: Improve logging for custom types

Apex has an interface called log.Fielder https://godoc.org/github.com/apex/log#Fielder. This lets custom types conform to this interface. For instance the struct:

type Foo struct {
        ID string
}

func (f Foo) Fields() log.Fields {
	return log.Fields{"id": i.ID}
}

Can now be easily logged, and will be correctly destructured in the logs.

log.WithFields(foo).Info("upload")

The equivalent with the events package is:

events.Log("upload", events.Args{
	{"id", foo.ID},
})

This becomes verbose as more fields are added to the struct, and it is logged in multiple places.

Another downside of destructuring by hand is that leads to inconsistency over time. The same struct might be logged differently in different places as new fields are added.

Filed as a request as I don't have a proposal for an API or implementation yet.

Create JSON logging Handler

Currently, the ecslogs handler logs out JSON, but doesn't handle things like MarshalJSON on struct fields in the config struct.

Would be nice to have something almost functionally equivalent to ecslogs, which just outputs JSON to standard out.

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.