diff options
author | Nicolas Pierron <nicolas.b.pierron@gmail.com> | 2009-11-14 20:14:15 +0000 |
---|---|---|
committer | Nicolas Pierron <nicolas.b.pierron@gmail.com> | 2009-11-14 20:14:15 +0000 |
commit | 7482474aefc3435d94b6932337085727517688db (patch) | |
tree | b0ea1c4ba1a8c30a5765b0cc5aef2e9f77e5986e /pkgs/lib/debug.nix | |
parent | 47de42835afe2b401c18f6c803100af28c5e176b (diff) | |
download | nixpkgs-7482474aefc3435d94b6932337085727517688db.tar nixpkgs-7482474aefc3435d94b6932337085727517688db.tar.gz nixpkgs-7482474aefc3435d94b6932337085727517688db.tar.bz2 nixpkgs-7482474aefc3435d94b6932337085727517688db.tar.lz nixpkgs-7482474aefc3435d94b6932337085727517688db.tar.xz nixpkgs-7482474aefc3435d94b6932337085727517688db.tar.zst nixpkgs-7482474aefc3435d94b6932337085727517688db.zip |
* Improve showVal: handle integer and strings.
svn path=/nixpkgs/trunk/; revision=18346
Diffstat (limited to 'pkgs/lib/debug.nix')
-rw-r--r-- | pkgs/lib/debug.nix | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pkgs/lib/debug.nix b/pkgs/lib/debug.nix index 4f757653bc0..5d411b864ec 100644 --- a/pkgs/lib/debug.nix +++ b/pkgs/lib/debug.nix @@ -1,6 +1,6 @@ let lib = import ./default.nix; -inherit (builtins) trace attrNamesToStr isAttrs isFunction isList head substring attrNames; +inherit (builtins) trace attrNamesToStr isAttrs isFunction isList isInt isString head substring attrNames; in @@ -37,7 +37,10 @@ rec { else if x == true then "x is boolean true" else if x == false then "x is boolean false" else if x == null then "x is null" - else "x is probably a string `${substring 0 50 x}...'"; + else if isInt x then "x is an integer `${toString x}'" + else if isString x then "x is a string `${substring 0 50 x}...'" + else "x is probably a path `${substring 0 50 (toString x)}'"; + # trace the arguments passed to function and its result traceCall = n : f : a : let t = n2 : x : traceShowValMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a)); traceCall2 = n : f : a : b : let t = n2 : x : traceShowValMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a) (t "arg 2" b)); |