How to use the debug.info function in debug

To help you get started, we’ve selected a few debug examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github filerjs / filer / src / filesystem.js View on Github external
var storedBuffer = e.target.result;
            if(!storedBuffer) {
              // There's no file data, so return zero bytes read
              end();
              debug.info("read <--");
              if(callback && "function" === typeof callback) {
                callback.call(undefined, undefined, 0, buffer);
              }
            } else {
              // Make sure we're not going to read past the end of the file
              var bytes = (ofd.pointer + buffer.length > storedBuffer.length) ? (storedBuffer.length - ofd.pointer) : buffer.length;
              // Copy the desired region from the file into the buffer supplied
              var storedBufferView = storedBuffer.subarray(ofd.pointer, ofd.pointer + bytes);
              buffer.set(storedBufferView);
              ofd.pointer += bytes;
              debug.info("read <--");
              if(callback && "function" === typeof callback) {
                callback.call(undefined, undefined, bytes, buffer);
              }
            }
          };
          getRequest.onerror = onerror.bind(null, transaction);
github filerjs / filer / src / filesystem.js View on Github external
function end() {
        -- ofd.pending;
        if(!ofd.valid && !ofd.pending) {
          if(ofd.oncomplete && "function" === typeof ofd.oncomplete) {
            debug.info("close <--");
            delete fds[descriptor];
            ofd.oncomplete.call();
          }
        }
      }
github filerjs / filer / src / filesystem.js View on Github external
function stat(transaction, fullpath, callback) {
      debug.info("stat -->");
      fullpath = path.normalize(fullpath);
      transaction = transaction || db.transaction([METADATA_STORE_NAME], IDB_RO);
      var store = transaction.objectStore(METADATA_STORE_NAME);
      var nameIndex = store.index(NAME_INDEX);
      var onerror = genericErrorHandler(callback);

      var getRequest = nameIndex.get(fullpath);
      getRequest.onsuccess = function(e) {        
        var result = e.target.result;
        if(!result) {
          onerror(transaction, new NoEntryError());
          return;
        } else {
          debug.info("stat <--");
          if(callback && "function" === typeof callback) {              
            callback.call(undefined, undefined, result);
github filerjs / filer / src / filesystem.js View on Github external
directoryRequest.onsuccess = function(e) {
            debug.info("mkdir <--");
            if(callback && "function" === typeof callback) {              
              callback.call(undefined, undefined);
            }
          };
          directoryRequest.onerror = onerror.bind(null, transaction);
github filerjs / filer / src / filesystem.js View on Github external
function open(fullpath, flags, mode, callback) {
      debug.info("open -->");      
      fullpath = path.normalize(fullpath);
      transaction = db.transaction([METADATA_STORE_NAME], IDB_RW);
      var metaStore = transaction.objectStore(METADATA_STORE_NAME);
      var fileStore = transaction.objectStore(FILE_STORE_NAME);
      var nameIndex = metaStore.index(NAME_INDEX);
      var onerror = genericErrorHandler(callback);

      if(undefined === flags) {
        flags = [];
      } else if("string" === typeof flags) {
        flags = [flags];
      }

      var getRequest = nameIndex.get(fullpath);
      getRequest.onsuccess = function(e) {
        var entry = e.target.result;
github filerjs / filer / src / filesystem.js View on Github external
function read(buffer, callback) {
        debug.info("read -->");
        var onerror = genericErrorHandler(callback);
        if(!start()) {
          onerror(null, new BadFileDescriptorError());
          return;
        }
        transaction = db.transaction([FILE_STORE_NAME], IDB_RO);
        transaction.oncomplete = function(e) {
          end();
        }
        var store = transaction.objectStore(FILE_STORE_NAME);        

        if(MIME_FILE === ofd.entry["contenttype"]) {
          var oid = ofd.entry["oid"];
          var getRequest = store.get(oid);
          getRequest.onsuccess = function(e) {
            var storedBuffer = e.target.result;
github filerjs / filer / src / filesystem.js View on Github external
fs.mkdir(transaction, "/", function(error) {
            if(error) {
              onerror(error);
            } else {
              debug.info("format <--");
              debug.info("mount <--");
              if(callback && "function" === typeof callback) {
                callback.call(undefined, undefined, fs.api());
              }
            }            
          });
        };
github filerjs / filer / src / filesystem.js View on Github external
function close(fd, callback) {
      debug.info("close -->");
      var onerror = genericErrorHandler(callback);
      if(!fds.hasOwnProperty(fd.descriptor)) {
        onerror(null, new BadFileDescriptorError());
        return;
      }
      var ofd = fds[fd.descriptor];
      ofd.valid = false;
      if(!ofd.valid && !ofd.pending) {
        debug.info("close <--");
        callback.call()
      } else {        
        ofd.oncomplete = callback;
      }
    }
github filerjs / filer / src / filesystem.js View on Github external
function complete() {
          var ofd;
          ofd = new OpenFileDescription(fullpath, file, flags, mode);
          var fd = new FileDescriptor(ofd);
          debug.info("open <--");
          if(callback && "function" === typeof callback) {              
            callback.call(undefined, undefined, fd);
          }
        }
      };
github filerjs / filer / src / filesystem.js View on Github external
deleteRequest.onsuccess = function(e) {
            debug.info("unlink <--");
            if(callback && "function" === typeof callback) {              
              callback.call(undefined, undefined);
            }
          };
          deleteRequest.onerror = onerror.bind(null, transaction);