nix-super/src/libutil/tests
Maximilian Bosch 6ccfdb79c7
libutil/logging: extend internal-json logger to make it more machine-readable
The new error-format is pretty nice from a UX point-of-view, however
it's fairly hard to parse the output e.g. for editor plugins such as
vim-ale[1] that use `nix-instantiate --parse` to determine syntax errors in
Nix expression files.

This patch extends the `internal-json` logger by adding the fields
`line`, `column` and `file` to easily locate an error in a file and the
field `raw_msg` which contains the error-message itself without
code-lines and additional helpers.

An exemplary output may look like this:

```
[nix-shell]$ ./inst/bin/nix-instantiate ~/test.nix --log-format minimal
{"action":"msg","column":1,"file":"/home/ma27/test.nix","level":0,"line":4,"raw_msg":"syntax error, unexpected IF, expecting $end","msg":"<full error-msg with code-lines etc>"}
```

[1] https://github.com/dense-analysis/ale
2020-07-26 02:29:57 +02:00
..
compression.cc Add compression unit tests 2020-06-08 11:34:37 +02:00
config.cc tests/config.cc: add tests for Config::applyConfig 2020-05-27 17:47:18 +02:00
hash.cc Revert the enum struct change 2020-06-18 22:11:26 +00:00
json.cc Add unit tests for "json.hh" 2020-05-25 11:57:45 +02:00
local.mk Add tests for logging.hh 2020-06-06 10:22:32 +02:00
logging.cc libutil/logging: extend internal-json logger to make it more machine-readable 2020-07-26 02:29:57 +02:00
lru-cache.cc src/libutil/tests/lru-cache.cc: Check erase() 2020-06-02 12:06:59 +02:00
pool.cc Add tests for pool.hh 2020-06-10 22:29:50 +02:00
tests.cc Add unit testes for url.cc 2020-05-20 16:37:35 +02:00
url.cc Add unit testes for url.cc 2020-05-20 16:37:35 +02:00
xml-writer.cc Add unit tests for xml-writer 2020-05-25 18:34:55 +02:00