From 7365671fb23861d59ece8d85de407c3127128ad8 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Mon, 2 Apr 2018 19:13:51 +0200 Subject: [PATCH] lib/debug: deprecate attrNamesToStr, traceXMLVal(Marked) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `attrNamesToStr` is very specific (and pretty trivial), so it doesn’t make sense to have it in the library. `traceXMLVal(Marked)` are just a builtin and `trace` and not very useful in general (trace output should not be parsed anyway). --- lib/debug.nix | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/debug.nix b/lib/debug.nix index 2e052ba31d85..fad6b769b39f 100644 --- a/lib/debug.nix +++ b/lib/debug.nix @@ -19,9 +19,6 @@ rec { traceValFn = f: x: trace (f x) x; traceVal = traceValFn id; - traceXMLVal = x: trace (builtins.toXML x) x; - traceXMLValMarked = str: x: trace (str + builtins.toXML x) x; - # strict trace functions (traced structure is fully evaluated and printed) /* `builtins.trace`, but the value is `builtins.deepSeq`ed first. */ @@ -55,7 +52,12 @@ rec { # this can help debug your code as well - designed to not produce thousands of lines traceShowVal = x: trace (showVal x) x; traceShowValMarked = str: x: trace (str + showVal x) x; - attrNamesToStr = a: lib.concatStringsSep "; " (map (x: "${x}=") (attrNames a)); + + attrNamesToStr = a: + trace ( "Warning: `attrNamesToStr` is deprecated " + + "and will be removed in the next release." ) + (lib.concatStringsSep "; " (map (x: "${x}=") (attrNames a))); + showVal = with lib; trace ( "Warning: `showVal` is deprecated " + "and will be removed in the next release, " @@ -76,6 +78,15 @@ rec { (modify x); in go); + traceXMLVal = x: + trace ( "Warning: `traceXMLVal` is deprecated " + + "and will be removed in the next release." ) + (trace (builtins.toXML x) x); + traceXMLValMarked = str: x: + trace ( "Warning: `traceXMLValMarked` is deprecated " + + "and will be removed in the next release." ) + (trace (str + builtins.toXML x) x); + # trace the arguments passed to function and its result # maybe rewrite these functions in a traceCallXml like style. Then one function is enough traceCall = n: f: a: let t = n2: x: traceShowValMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a));