diff options
author | Peter Simons <simons@cryp.to> | 2016-08-19 11:10:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-19 11:10:27 +0200 |
commit | 99252ad1b4ffc3fff5ebd2022118e92766fc90cc (patch) | |
tree | dbe6ef5a6c9379ec1b295fbeb4dc1b9ed77c791e /lib | |
parent | 36f2dc56493757342e0c86c3df6431bce77eed31 (diff) | |
parent | 4dfdb27e001eceb66170757dabc0d7e3ed61ca3d (diff) |
Merge pull request #17762 from copumpkin/warnings
lib.{warn, info}: add simple helpers
Diffstat (limited to 'lib')
-rw-r--r-- | lib/trivial.nix | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/trivial.nix b/lib/trivial.nix index 21642ca0bdc1e..25ce35570fdf6 100644 --- a/lib/trivial.nix +++ b/lib/trivial.nix @@ -98,4 +98,19 @@ rec { */ importJSON = path: builtins.fromJSON (builtins.readFile path); + + /* See https://github.com/NixOS/nix/issues/749. Eventually we'd like these + to expand to Nix builtins that carry metadata so that Nix can filter out + the INFO messages without parsing the message string. + + Usage: + { + foo = lib.warn "foo is deprecated" oldFoo; + } + + TODO: figure out a clever way to integrate location information from + something like __unsafeGetAttrPos. + */ + warn = msg: builtins.trace "WARNING: ${msg}"; + info = msg: builtins.trace "INFO: ${msg}"; } |