]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/lily.scm
Proper loglevels: cmd-line option --loglevel=NONE/ERROR/WARN/BASIC/PROGRESS/DEBUG
[lilypond.git] / scm / lily.scm
index 17c8d1776b2a2d436aa16798115f392170ea13c7..c2b4fa7f2b4a06200d0cfe92154be2145fb11809 100644 (file)
 
 (defmacro-public _i (x) x)
 
+;;; Boolean thunk - are we integrating Guile V2.0 or higher with LilyPond?
+(define-public (guile-v2)
+  (string>? (version) "1.9.10"))
+
 (read-enable 'positions)
+(if (not (guile-v2))
+    (debug-enable 'debug)
+    (begin
+      (debug-enable 'backtrace)
+      (debug-enable 'show-file-name)))
 
 (define-public PLATFORM
   (string->symbol
@@ -170,8 +179,8 @@ second.  Dump results to `FILE.stacks' and
 `FILE.graph'.")
     (trace-scheme-coverage #f
 "Record coverage of Scheme files in `FILE.cov'.")
-    (verbose ,(ly:command-line-verbose?)
-"Value of the --verbose flag (read-only).")
+    (verbose ,(ly:verbose-output?)
+"Verbose output, i.e. loglevel at least DEBUG (read-only).")
     (warning-as-error #f
 "Change all warning and programming_error
 messages into errors.")
@@ -195,10 +204,6 @@ messages into errors.")
 
 ;;(set-debug-cell-accesses! 1000)
 
-;;; Boolean thunk - are we integrating Guile V2.0 or higher with LilyPond?
-(define-public (guile-v2)
-  (string>? (version) "1.9.10"))
-
 (use-modules (ice-9 regex)
             (ice-9 safe)
             (ice-9 format)
@@ -221,13 +226,10 @@ messages into errors.")
 
 (cond
   ((guile-v2)
-   (if (ly:get-option 'verbose)
-       (ly:message  (_ "Using (ice-9 curried-definitions) module\n")))
+   (ly:debug (_ "Using (ice-9 curried-definitions) module\n"))
    (use-modules (ice-9 curried-definitions)))
   (else
-    (if (ly:get-option 'verbose)
-       (ly:message
-          (_ "Guile 1.8\n")))))
+    (ly:debug (_ "Guile 1.8\n"))))
 
 ;; TODO add in modules for V1.8.7 deprecated in V2.0 and integrated
 ;; into Guile base code, like (ice-9 syncase).
@@ -284,13 +286,14 @@ messages into errors.")
 
 (define-public (ly:load x)
   (let* ((file-name (%search-load-path x)))
-    (if (ly:get-option 'verbose)
-       (ly:progress "[~A" file-name))
+    (ly:debug "[~A" file-name)
     (if (not file-name)
-       (ly:error (_ "cannot find: ~A") x))
+        (ly:error (_ "cannot find: ~A") x))
     (primitive-load-path file-name)  ;; to support Guile V2 autocompile
+    ;; TODO: Any chance to use ly:debug here? Need to extend it to prevent
+    ;;       a newline in this case
     (if (ly:get-option 'verbose)
-       (ly:progress "]\n"))))
+        (ly:progress "]\n"))))
 
 (define-public DOS
   (let ((platform (string-tokenize