diff --git a/core/logger/src/logger.ts b/core/logger/src/logger.ts index f9306c2c8..b662a22db 100644 --- a/core/logger/src/logger.ts +++ b/core/logger/src/logger.ts @@ -126,10 +126,6 @@ export const createLogger = (scope: string, color?: string | null, debug?: boole color, scope, - incident: isBrowser - ? console.log.bind(console, '%c%s%c.%s() Incident `%s` %s!', styleScope, scope, 'color: orange;') - : console.log.bind(console, `${styleScope}🚸\n%s${style.reset}.%s() Incident \`%s\` %s!${style.reset}`, scope), - accident: isBrowser ? console.warn.bind(console, '%c%s%c.%s() Accident `%s` %s!', styleScope, scope, style.reset) : console.warn.bind(console, `${styleScope}⚠️\n%s\x1b[33m.%s() Accident \`%s\` %s!${style.reset}`, scope), @@ -147,6 +143,7 @@ export const createLogger = (scope: string, color?: string | null, debug?: boole logMethodArgs: empty, logMethodFull: empty, logOther: empty, + incident: empty, }; } @@ -163,5 +160,9 @@ export const createLogger = (scope: string, color?: string | null, debug?: boole logMethodFull: console.debug.bind(console, keySection + '.%s(%o) => %o', styleScope, scope, style.reset), logOther: console.debug.bind(console, keySection, styleScope, scope, style.reset), + + incident: isBrowser + ? console.log.bind(console, '%c%s%c.%s() Incident `%s` %s!', styleScope, scope, 'color: orange;') + : console.log.bind(console, `${styleScope}🚸\n%s${style.reset}.%s() Incident \`%s\` %s!${style.reset}`, scope), }; }; diff --git a/core/logger/src/type.ts b/core/logger/src/type.ts index ed6aa7fa7..f2d8b6983 100644 --- a/core/logger/src/type.ts +++ b/core/logger/src/type.ts @@ -96,7 +96,8 @@ export interface AlwatrLogger { logMethodFull(method: string, args: Record | string | number | boolean, result: unknown): void; /** - * `console.log` an event or expected accident. (not warn or error) + * `console.log` an event or expected accident. + * not warn or error just important information. * * Example: * @@ -107,7 +108,7 @@ export interface AlwatrLogger { incident(method: string, code: string, desc: string, ...args: unknown[]): void; /** - * `console.warn` an unexpected accident or error that you handled. + * `console.warn` an unexpected accident or error that you handled like warning. * * Example: * diff --git a/core/nano-server/src/nano-server.ts b/core/nano-server/src/nano-server.ts index f58c8baab..782531f65 100644 --- a/core/nano-server/src/nano-server.ts +++ b/core/nano-server/src/nano-server.ts @@ -403,6 +403,11 @@ export class AlwatrConnection { * ``` */ async getBody(): Promise { + // method must be POST or PUT or PATCH + if (!(this.method === 'POST' || this.method === 'PUT' || this.method === 'PATCH')) { + return null; + } + let body = ''; this.incomingMessage.on('data', (chunk: unknown) => { diff --git a/core/storage-client/src/storage-client.ts b/core/storage-client/src/storage-client.ts index 102ef3032..e96e7fb2b 100644 --- a/core/storage-client/src/storage-client.ts +++ b/core/storage-client/src/storage-client.ts @@ -51,7 +51,7 @@ alwatrRegisteredList.push({ * * console.log('has \'alimd\': %o', await db.has('alimd')); * console.log('keys: %o', await db.keys()); - * console.log('getAll: %o', await db.getAll()); + * console.log('getStorage: %o', await db.getStorage()); * console.log('delete: %o', await db.delete('alimd')); * try { * await db.delete('abcd'); @@ -102,7 +102,7 @@ export class AlwatrStorageClient