org.symbian.tools.wrttools/projecttemplates/WRTKit/Utils/Logger.js
changeset 102 30e0796f3ebb
parent 73 c56c874eef47
child 210 0f7abfd6ae62
equal deleted inserted replaced
101:15f3b303bbb1 102:30e0796f3ebb
    64 // Dumps an objects properties and methods to the console.
    64 // Dumps an objects properties and methods to the console.
    65 Logger.prototype.dump = function(obj) {
    65 Logger.prototype.dump = function(obj) {
    66     if (this.enabled) {
    66     if (this.enabled) {
    67         console.dir(obj);
    67         console.dir(obj);
    68     }
    68     }
    69 }
    69 };
    70 
    70 
    71 // Dumps a stracktrace to the console.
    71 // Dumps a stracktrace to the console.
    72 Logger.prototype.trace = function() {
    72 Logger.prototype.trace = function() {
    73     if (this.enabled) {
    73     if (this.enabled) {
    74         console.trace();
    74         console.trace();
    75     }
    75     }
    76 }
    76 };
    77 
    77 
    78 // Prints a debug message to the console.
    78 // Prints a debug message to the console.
    79 Logger.prototype.debug = function(str) {
    79 Logger.prototype.debug = function(str) {
    80     if (this.enabled && this.level <= this.LOG_LEVEL_DEBUG) {
    80     if (this.enabled && this.level <= this.LOG_LEVEL_DEBUG) {
    81         if (this.filter == null) {
    81         if (this.filter == null) {
    91             if (show) {
    91             if (show) {
    92                 console.debug(str);
    92                 console.debug(str);
    93             }
    93             }
    94         }
    94         }
    95     }
    95     }
    96 }
    96 };
    97 
    97 
    98 // Prints an info message to the console.
    98 // Prints an info message to the console.
    99 Logger.prototype.info = function(str) {
    99 Logger.prototype.info = function(str) {
   100     if (this.enabled && this.level <= this.LOG_LEVEL_INFO) {
   100     if (this.enabled && this.level <= this.LOG_LEVEL_INFO) {
   101         console.info(str);
   101         console.info(str);
   102     }
   102     }
   103 }
   103 };
   104 
   104 
   105 // Prints a warning message to the console.
   105 // Prints a warning message to the console.
   106 Logger.prototype.warn = function(str) {
   106 Logger.prototype.warn = function(str) {
   107     if (this.enabled && this.level <= this.LOG_LEVEL_WARN) {
   107     if (this.enabled && this.level <= this.LOG_LEVEL_WARN) {
   108         console.warn(str);
   108         console.warn(str);
   109     }
   109     }
   110 }
   110 };
   111 
   111 
   112 // Prints an error message to the console.
   112 // Prints an error message to the console.
   113 Logger.prototype.error = function(str) {
   113 Logger.prototype.error = function(str) {
   114     if (this.enabled && this.level <= this.LOG_LEVEL_ERROR) {
   114     if (this.enabled && this.level <= this.LOG_LEVEL_ERROR) {
   115         console.error(str);
   115         console.error(str);
   116     }
   116     }
   117 }
   117 };