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

https://github.com/vikpe/prettyfmt

Go fmt with colored prefix and timestamp.
https://github.com/vikpe/prettyfmt

go print terminal

Last synced: 2 months ago
JSON representation

Go fmt with colored prefix and timestamp.

Awesome Lists containing this project

README

          

# prettyfmt [![Test](https://github.com/vikpe/prettyfmt/actions/workflows/test.yml/badge.svg)](https://github.com/vikpe/prettyfmt/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/vikpe/prettyfmt/branch/main/graph/badge.svg?token=sc5Hd7M4wv)](https://codecov.io/gh/vikpe/prettyfmt) [![Go Report Card](https://goreportcard.com/badge/github.com/vikpe/prettyfmt)](https://goreportcard.com/report/github.com/vikpe/prettyfmt)
> Go fmt with colored prefix and timestamp

```shell
go get github.com/vikpe/prettyfmt
```

## Synopsis

Colors from [github.com/fatih/color](https://github.com/fatih/color) ([list of values](https://github.com/fatih/color/blob/main/color.go#L69))

```
New(
prefix string,
prefixColor color.Attribute,
timestampFormat string,
timestampColor color.Attribute
)
```

## Usage
```go
pfmt := prettyfmt.New("chatbot", color.FgHiBlue, "15:04:05", color.FgWhite)
pfmt.Println("start")
pfmt.Printfln("connected as %s", "vikpebot")
```

![image](https://user-images.githubusercontent.com/1616817/177564266-297c02a7-d5be-40b8-aac0-d97b3829830c.png)