diff options
| author | 木杉 <zhmushan@qq.com> | 2019-01-21 23:35:07 +0800 |
|---|---|---|
| committer | Ryan Dahl <ry@tinyclouds.org> | 2019-01-21 09:35:07 -0600 |
| commit | d710f9427af35363fb7f9b82d09eae5bd8342a63 (patch) | |
| tree | 62846aa4ebbc234434105c868dfa24ee1f77ff90 | |
| parent | 52fdf581a8dae226da7a7d5eae4498071a98eed2 (diff) | |
fix format (denoland/deno_std#140)
Original: https://github.com/denoland/deno_std/commit/61a3911be7e01273e13bf35a3a16285f413f0b70
| -rw-r--r-- | datetime/test.ts | 4 | ||||
| -rwxr-xr-x | format.ts | 6 | ||||
| -rw-r--r-- | log/handlers.ts | 7 | ||||
| -rw-r--r-- | log/test.ts | 31 |
4 files changed, 21 insertions, 27 deletions
diff --git a/datetime/test.ts b/datetime/test.ts index 5bc7eda21..ce8193dfb 100644 --- a/datetime/test.ts +++ b/datetime/test.ts @@ -31,7 +31,7 @@ test(function parseDateTime() { test(function invalidParseDateTimeFormatThrows() { try { (datetime as any).parseDateTime("2019-01-01 00:00", "x-y-z"); - assert(false, 'no exception was thrown'); + assert(false, "no exception was thrown"); } catch (e) { assertEqual(e.message, "Invalid datetime format!"); } @@ -55,7 +55,7 @@ test(function parseDate() { test(function invalidParseDateFormatThrows() { try { (datetime as any).parseDate("2019-01-01", "x-y-z"); - assert(false, 'no exception was thrown'); + assert(false, "no exception was thrown"); } catch (e) { assertEqual(e.message, "Invalid date format!"); } @@ -27,11 +27,7 @@ async function main() { await checkVersion(); const prettier = run({ - args: [ - "bash", - "-c", - "prettier --write *.ts */*.ts */**/*.ts *.md */*.md */**/*.md" - ] + args: ["bash", "-c", "prettier --write '**/*.ts' '**/*.md'"] }); const s = await prettier.status(); exit(s.code); diff --git a/log/handlers.ts b/log/handlers.ts index bb684bdef..c39102c8e 100644 --- a/log/handlers.ts +++ b/log/handlers.ts @@ -32,7 +32,7 @@ export class BaseHandler { if (this.formatter instanceof Function) { return this.formatter(logRecord); } - + return this.formatter.replace(/{(\S+)}/g, (match, p1) => { const value = logRecord[p1]; @@ -73,10 +73,7 @@ export class FileHandler extends WriterHandler { private _file: File; private _filename: string; - constructor( - levelName: string, - options: FileHandlerOptions, - ) { + constructor(levelName: string, options: FileHandlerOptions) { super(levelName, options); this._filename = options.filename; } diff --git a/log/test.ts b/log/test.ts index 4b623207f..2f3431348 100644 --- a/log/test.ts +++ b/log/test.ts @@ -32,15 +32,15 @@ test(function testDefaultlogMethods() { test(async function testDefaultFormatter() { await log.setup({ handlers: { - test: new TestHandler("DEBUG"), + test: new TestHandler("DEBUG") }, loggers: { test: { level: "DEBUG", - handlers: ["test"], - }, - }, + handlers: ["test"] + } + } }); const logger = log.getLogger("test"); @@ -53,16 +53,16 @@ test(async function testFormatterAsString() { await log.setup({ handlers: { test: new TestHandler("DEBUG", { - formatter: "test {levelName} {msg}", - }), + formatter: "test {levelName} {msg}" + }) }, loggers: { test: { level: "DEBUG", - handlers: ["test"], - }, - }, + handlers: ["test"] + } + } }); const logger = log.getLogger("test"); @@ -75,20 +75,21 @@ test(async function testFormatterAsFunction() { await log.setup({ handlers: { test: new TestHandler("DEBUG", { - formatter: logRecord => `fn formmatter ${logRecord.levelName} ${logRecord.msg}`, - }), + formatter: logRecord => + `fn formmatter ${logRecord.levelName} ${logRecord.msg}` + }) }, loggers: { test: { level: "DEBUG", - handlers: ["test"], - }, - }, + handlers: ["test"] + } + } }); const logger = log.getLogger("test"); const handler = log.getHandler("test"); logger.error("Hello, world!"); assertEqual(handler.testOutput, "fn formmatter ERROR Hello, world!\n"); -});
\ No newline at end of file +}); |
