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

https://github.com/cattlecloud/ulog

ulog is a simple and efficient level logging library for Go
https://github.com/cattlecloud/ulog

efficient go golang leveled log logging simple

Last synced: about 1 month ago
JSON representation

ulog is a simple and efficient level logging library for Go

Awesome Lists containing this project

README

          

# ulog

[![Go Reference](https://pkg.go.dev/badge/cattlecloud.net/go/ulog.svg)](https://pkg.go.dev/cattlecloud.net/go/ulog)
[![License](https://img.shields.io/github/license/cattlecloud/ulog?color=7C00D8&style=flat-square&label=License)](https://github.com/cattlecloud/ulog/blob/main/LICENSE)
[![Build](https://img.shields.io/github/actions/workflow/status/cattlecloud/ulog/ci.yaml?style=flat-square&color=0FAA07&label=Tests)](https://github.com/cattlecloud/ulog/actions/workflows/ci.yaml)

`ulog` is a simple and efficient level logging library for Go

### Getting Started

The `ulog` package can be added to a project with `go get`.

```shell
go get cattlecloud.net/go/ulog@latest
```

### Examples

```go
log := ulog.New("my/component")
log.E.Fmt("the level is %s", "error")
log.W.Fmt("the level is %s", "warn")
log.I.Fmt("the level is %s", "info")
log.D.Fmt("the level is %s", "debug")
log.T.Fmt("the level is %s", "trace")
```

### Exclude timestamp

When running under systemd it is nice to not include the redundant timestamp
directly from the logging package (since journald will already insert one). To
exclude the timestamp simply set the `ULOG_NOTIMESTAMP` environment variable
to `true`.

e.g. in a systemd unit file

```
[Service]
# ...
Environment="ULOG_NOTIMESTAMP=true"
```

### License

The `cattlecloud.net/go/ulog` module is open source under the [BSD-3-Clause](LICENSE) license.