File: README.md

package info (click to toggle)
golang-github-rubyist-tracerx 0.0~git20170927.0.7879593-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, bullseye-backports, buster, buster-backports
  • size: 56 kB
  • ctags: 15
  • sloc: makefile: 2
file content (45 lines) | stat: -rw-r--r-- 1,222 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# tracerx

Tracerx is a simple tracing package that logs messages depending on environment variables.
It is very much inspired by git's GIT_TRACE mechanism.

[![GoDoc](https://godoc.org/github.com/rubyist/tracerx?status.svg)](https://godoc.org/github.com/rubyist/tracerx)

## Installation

```
  go get github.com/rubyist/tracerx
```

## Example

```go
tracerx.DefaultKey = "FOO"
tracerx.Printf("send message")

tracerx.PrintfKey("BAR", "do a thing")

t := time.Now()
// Do some stuff
tracerx.PerformanceSince("BAR", "command x", t)
```

This example will send tracing output based on the environment variables `FOO_TRACE` and `BAR_TRACE`.

The values control where the tracing is output as follows:

```
unset, 0, or "false":   no output
1, 2:                   stderr
absolute path:          output will be written to the file
3 - 10:                 output will be written to that file descriptor
```

If an associated `BAR_TRACE_PERFORMANCE` is set to 1 or "true", the `PerformanceSince` line will
output timing information.

Keys can also be disabled. See the GoDoc for full API documentation.

## Bugs, Issues, Feedback

Right here on GitHub: [https://github.com/rubyist/tracerx](https://github.com/rubyist/tracerx)