Merge pull request #229 from Overdrivr/implement-debug-strings
Implement debug strings
This commit is contained in:
commit
eb11b4d660
|
@ -11,6 +11,7 @@ var IncomingForm = require('formidable');
|
|||
var StringDecoder = require('string_decoder').StringDecoder;
|
||||
var path = require('path');
|
||||
var uuid = require('uuid');
|
||||
var debug = require('debug')('loopback:storage:handler');
|
||||
|
||||
var defaultOptions = {
|
||||
maxFileSize: 10 * 1024 * 1024, // 10 MB
|
||||
|
@ -37,6 +38,7 @@ exports.upload = function(provider, req, res, options, cb) {
|
|||
|
||||
var form = new IncomingForm(options);
|
||||
var container = options.container || req.params.container;
|
||||
debug('Uploading to container with options %o', options);
|
||||
var fields = {};
|
||||
var files = {};
|
||||
form.handlePart = function(part) {
|
||||
|
|
|
@ -8,6 +8,7 @@ var factory = require('./factory');
|
|||
var handler = require('./storage-handler');
|
||||
|
||||
var storage = require('pkgcloud').storage;
|
||||
var debug = require('debug')('loopback:storage:service');
|
||||
|
||||
module.exports = StorageService;
|
||||
|
||||
|
@ -93,6 +94,7 @@ StorageService.prototype.createContainer = function(options, cb) {
|
|||
var Container = factory.getProvider(this.provider).storage.Container;
|
||||
options = new Container(this.client, options);
|
||||
}
|
||||
debug('Creating container with options %o', options);
|
||||
return this.client.createContainer(options, function(err, container) {
|
||||
return cb(err, map(container));
|
||||
});
|
||||
|
@ -145,7 +147,7 @@ StorageService.prototype.uploadStream = function(container, file, options) {
|
|||
if (file) {
|
||||
options.remote = file;
|
||||
}
|
||||
|
||||
debug('Obtaining upload stream for file %s and options %o', file, options);
|
||||
return this.client.upload(options);
|
||||
};
|
||||
|
||||
|
@ -169,7 +171,7 @@ StorageService.prototype.downloadStream = function(container, file, options) {
|
|||
if (file) {
|
||||
options.remote = file;
|
||||
}
|
||||
|
||||
debug('Obtaining download stream for file %s and options %o', file, options);
|
||||
return this.client.download(options);
|
||||
};
|
||||
|
||||
|
@ -232,6 +234,7 @@ StorageService.prototype.removeFile = function(container, file, cb) {
|
|||
* @param {Function} cb Callback function
|
||||
*/
|
||||
StorageService.prototype.upload = function(container, req, res, options, cb) {
|
||||
debug('Configuring upload with options %o', options);
|
||||
// Test if container is req for backward compatibility
|
||||
if (typeof container === 'object' && container.url && container.method) {
|
||||
// First argument is req, shift all args
|
||||
|
@ -265,6 +268,7 @@ StorageService.prototype.upload = function(container, req, res, options, cb) {
|
|||
if (typeof container === 'string') {
|
||||
options.container = container;
|
||||
}
|
||||
debug('Upload configured with options %o', options);
|
||||
return handler.upload(this.client, req, res, options, cb);
|
||||
};
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"async": "^2.1.5",
|
||||
"debug": "^3.1.0",
|
||||
"formidable": "^1.0.16",
|
||||
"pkgcloud": "^1.1.0",
|
||||
"strong-globalize": "^2.6.2",
|
||||
|
|
Loading…
Reference in New Issue