diff --git a/ftpd/ftpd-tests.ts b/ftpd/ftpd-tests.ts index 8942dedcb7..671ccf7053 100644 --- a/ftpd/ftpd-tests.ts +++ b/ftpd/ftpd-tests.ts @@ -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); diff --git a/ftpd/index.d.ts b/ftpd/index.d.ts index 6e3230dd3b..cd325109ee 100644 --- a/ftpd/index.d.ts +++ b/ftpd/index.d.ts @@ -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; }