summary refs log tree commit diff
path: root/lib/debug.nix
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2018-04-02 19:13:51 +0200
committerProfpatsch <mail@profpatsch.de>2018-04-27 18:59:39 +0200
commit7365671fb23861d59ece8d85de407c3127128ad8 (patch)
tree0a0851780e1ec5766f572f44d3e4a24f7d32f219 /lib/debug.nix
parenta7fdd10bf321f2db45c7fcdb79a39d7bc75bb828 (diff)
downloadnixlib-7365671fb23861d59ece8d85de407c3127128ad8.tar
nixlib-7365671fb23861d59ece8d85de407c3127128ad8.tar.gz
nixlib-7365671fb23861d59ece8d85de407c3127128ad8.tar.bz2
nixlib-7365671fb23861d59ece8d85de407c3127128ad8.tar.lz
nixlib-7365671fb23861d59ece8d85de407c3127128ad8.tar.xz
nixlib-7365671fb23861d59ece8d85de407c3127128ad8.tar.zst
nixlib-7365671fb23861d59ece8d85de407c3127128ad8.zip
lib/debug: deprecate attrNamesToStr, traceXMLVal(Marked)
`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).
Diffstat (limited to 'lib/debug.nix')
-rw-r--r--lib/debug.nix19
1 files 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));