Merge pull request #13160 from EricByers/ftpd-changes

Adding ftpd logLevel to options and runtime, also adding tests
This commit is contained in:
Ron Buckton
2016-12-07 15:10:17 -08:00
committed by GitHub
2 changed files with 23 additions and 3 deletions
+5 -3
View File
@@ -9,7 +9,8 @@ var options: ftpd.FtpServerOptions = {
},
getRoot: function(connection: ftpd.FtpConnection): string {
return '/';
}
},
logLevel: ftpd.LogLevel.ERROR
};
var host: string = '10.0.0.42';
@@ -21,11 +22,12 @@ server.on('client:connected', function(conn: ftpd.FtpConnection): void {
success();
});
conn.on('command:pass', function(
pass: string,
success: (username: string, fs?: ftpd.FtpFileSystem) => void,
pass: string,
success: (username: string, fs?: ftpd.FtpFileSystem) => void,
failure: () => void) {
success("Rogier");
});
});
server.debugging = ftpd.LogLevel.TRACE;
server.listen(21);
+18
View File
@@ -12,6 +12,14 @@ import fs = require("fs");
import net = require("net");
import tls = require("tls");
export const enum LogLevel {
ERROR = 0,
WARN = 1,
INFO = 2,
DEBUG = 3,
TRACE = 4
}
/**
* Options for FtpServer constructor
*/
@@ -85,6 +93,11 @@ export interface FtpServerOptions {
* Integer, specifies the upper-bound port (max port) for creating PASV connections
*/
pasvPortRangeEnd?: number;
/**
* Integer from 0-4 representing the Log Level to show.
*/
logLevel?: LogLevel;
}
/**
@@ -195,4 +208,9 @@ export declare class FtpServer extends events.EventEmitter {
* Stop listening
*/
public close(callback?: () => void): void;
/**
* Change/Retrieve logLevel at runtime.
*/
public debugging: LogLevel;
}