• Stars
    star
    16
  • Rank 1,311,288 (Top 26 %)
  • Language
    Go
  • License
    Other
  • Created over 5 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

io.Writer implementation using logrus logger [managed by soy-programador]

logrusiowriter

io.Writer implementation using logrus

Travis CI build status GoDoc Coverage Status Mentioned in Awesome Go

Motivation

Many golang libraries use the golang's log package to print their logs. This means that if your application uses logrus to print structured logging, those packages will print a format that is (probably) incompatible with yours, and you may end losing logs in your logs collector because they can't be parsed properly.

Solution

Print the logs written using log.Printf through logrus, by setting log.SetOutput to an io.Writer implementation that uses logrus as output, i.e.:

	log.SetOutput(logrusiowriter.New())

See example_*_test.go files to find testable examples that serve as documentation.

Simple solution

Or... you can simply use the standard APIs that logrus provides, i.e., this does the same as this package:

    log.SetOutput(logrus.WithFields(logrus.Fields{"logger": "stdlib"}).WriterLevel(logrus.InfoLevel))

So, unless you want this to be configurable using an envconfig-filled struct, there's no reason to use this library.

More Repositories

1

gotoprom

Type-safe Prometheus metrics builder library for golang [managed by soy-programador]
Go
109
star
2

timex

A test-friendly replacement for golang's time package [managed by soy-programador]
Go
70
star
3

aceptadora

Aceptadora provides the boilerplate to orchestrate the containers for an acceptance test. [managed by soy-programador]
Go
57
star
4

prom-react

Add Prometheus metrics to your React App. Built on top of promjs and react-performance libraries [managed by soy-programador]
TypeScript
27
star
5

deckset-slides-theme

A custom, on brand Cabify theme for Deckset, the app to create super nice presentations with just Markdown
17
star
6

figma-plugin-frametastic

Add your favorite frame sizes combinations to easily test your designs in different viewports.
HTML
8
star
7

couchdb-admin

CouchDB admin tooling
Go
7
star
8

runnerpool

Golang library providing a limited worker pool implementation [managed by soy-programador]
Go
6
star
9

better-crowdin

Crowdin CLI on steroids
JavaScript
5
star
10

foam

A SOAP 1.1 client [managed by soy-programador]
Go
5
star
11

repoman

Magefile Repository Manager Support Package.
Go
5
star
12

MobileChallenge

Mobile Challenge for Android and iOS candidates repository [managed by soy-programador]
4
star
13

frontend-shopping-cart-challenge-basic

Cabify basic shopping cart challenge
CSS
2
star
14

cabify_payments_js_encryption

JS client library for encrypting payment details before sending them to the server.
JavaScript
2
star
15

eslint-config

ESLint config for Cabify Javascript projects [managed by soy-programador]
JavaScript
2
star
16

systems-challenge

Cabify Systems Technical Challenge
Ruby
2
star
17

couchrest_model_elastic

Add Elasticsearch to your CouchRest models
Ruby
1
star
18

package-build-javascript

Package build configuration based on Rollup to compile JS packages
JavaScript
1
star
19

motion-maps-wrapper

A common API plus some helpers for the Apple and Google maps frameworks to use with RubyMotion.
Ruby
1
star
20

gofixunkeyedcomposites

Command gofixunkeyedcomposites adds keys to composite literal fields.
Go
1
star
21

ui-metropolis-challenge

Cabify UI Metropolis challenge
1
star
22

go-logging

Simple logging package for Go [managed by soy-programador]
Go
1
star