【发布时间】:2018-01-16 16:38:30
【问题描述】:
在 nix 中开发时,我通常使用builtins.trace 进行调试:
在代码中
a = { foo = "bar"; ... more complex nested attrset ...};
builtins.trace a a;
在 nix-repl 中
在复杂的数据结构上使用:p a 也很难阅读。
问题
但是,输出只是一行,没有任何格式,对于复杂的数据结构,这几乎无法用于调试。
问题
nix 中是否有一个漂亮的打印功能可以缩进和添加换行符?甚至更好的彩色输出?
理想输出
我想看看这样的东西:
default = {
active = {
check_ssl = [
{
tags = [ "mycustomtag" ];
host = "kotalla.de";
ipv6 = false;
name = "ssl11";
}
{
tags = [ "mycustomtag" ];
host = "kotalla.de";
ipv6 = false;
name = "ssl2";
}
];
check_http = [
{
host = "kotalla.de";
port = 80;
url = "/foo";
contains = "Labor";
name = "http";
}
];
check_ssh = [
{
host = "mail.lastlog.de";
port = 20202;
name = "ssh";
}
];
};
我的秘诀
我知道的:
【问题讨论】: