linterna-magica-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linterna-magica-commit] [106] Improoved debug output when logging to co


From: Ivaylo Valkov
Subject: [linterna-magica-commit] [106] Improoved debug output when logging to console.
Date: Tue, 05 Jul 2011 08:04:59 +0000

Revision: 106
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=linterna-magica&revision=106
Author:   valkov
Date:     2011-07-05 08:04:58 +0000 (Tue, 05 Jul 2011)
Log Message:
-----------
Improoved debug output when logging to console. The text is indented according 
to log/debug level.

Modified Paths:
--------------
    trunk/src/lm_log.js

Modified: trunk/src/lm_log.js
===================================================================
--- trunk/src/lm_log.js 2011-07-01 09:50:24 UTC (rev 105)
+++ trunk/src/lm_log.js 2011-07-05 08:04:58 UTC (rev 106)
@@ -66,8 +66,23 @@
                    date.getSeconds(), date.getMilliseconds()].join(":");
        var host_get = w.self;
        var host = host_get.location.hostname;
+
+       var indent = "";
+
+       if (this.log_to != "web")
+       {
+           for (var i=0, l=level; i<l; i++)
+           {
+               indent += "\t";
+           }
+       }
+
        var log_string = message + " at "+host + " time: "+str;
+       var level_string =  " ("+level+") ";
 
+       log_string = log_string.replace(/^/, indent+level_string).
+           replace(/\n/, "\n"+indent+level_string);
+
        try
        {
            if (this.log_to == "web")




reply via email to

[Prev in Thread] Current Thread [Next in Thread]