segmentio / events Goto Github PK
View Code? Open in Web Editor NEWGo package for routing, formatting and publishing events produced by a program.
License: MIT License
Go package for routing, formatting and publishing events produced by a program.
License: MIT License
@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?
It would be nice if segmentio/events created sentry breadcrumbs for each log event.
Looking at this Sentry issue, getsentry/sentry-go#43, it seems like the implementation would be something like this: getsentry/sentry-go#43 (comment)
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
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.