Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wayneashleyberry/logfmt

An opinionated log formatter that you probably don't want to use.
https://github.com/wayneashleyberry/logfmt

cli command-line fmt formatter gcp go golang google-cloud log

Last synced: 29 days ago
JSON representation

An opinionated log formatter that you probably don't want to use.

Awesome Lists containing this project

README

        

> An opinionated log formatter that you probably don't want to use.

- `logfmt` reads from stdin and prints formatted logs
- `logfmt` expects structured json with certain keys
- `logfmt` formats output to be similar to Google Cloud Platform Logging

### Installation

You will need to have your `$PATH` setup to your go installation.

```
# Add this to your terminal .rc file
export PATH="$HOME/go/bin:$PATH"
```

```sh
go get -u github.com/wayneashleyberry/logfmt
```

### Usage

`logfmt` reads from stdin, so pipe the output from your service into `logfmt`:

```sh
go run myapp.go | logfmt
```

### Example

```sh
cat testdata/test.json | go run main.go
```

screen shot 2018-05-27 at 12 27 47