@alwatr/logger
Advanced tools
Comparing version 1.2.0 to 2.0.0
@@ -6,2 +6,19 @@ # Change Log | ||
# [2.0.0](https://github.com/AliMD/alwatr-eslib/compare/@alwatr/logger@1.2.0...@alwatr/logger@2.0.0) (2023-10-23) | ||
### Bug Fixes | ||
* **logger:** remove globalAlwatr ([e7a7236](https://github.com/AliMD/alwatr-eslib/commit/e7a72361715cbeb05c5dea4dbff7c2b583d2eab2)) by @AliMD | ||
### Features | ||
* **logger:** define logger package ([5beaaf4](https://github.com/AliMD/alwatr-eslib/commit/5beaaf4f6f2f74d4976f9d0d58927526f283d5f9)) by @AliMD | ||
* **logger:** definePackage, the new api for global alwatr ([e3635e2](https://github.com/AliMD/alwatr-eslib/commit/e3635e2012e5ab5a79622693c5bf7c4639840258)) by @AliMD | ||
* **logger:** remove desc from incident & accident ([fa38b68](https://github.com/AliMD/alwatr-eslib/commit/fa38b68ce63524f1b53f3ad135450289eff66ae8)) by @AliMD | ||
### BREAKING CHANGES | ||
* **logger:** remove desc from incident & accident | ||
* **logger:** global Alwatr.registeredList not exist anymore | ||
# [1.2.0](https://github.com/AliMD/alwatr-eslib/compare/@alwatr/logger@1.1.5...@alwatr/logger@1.2.0) (2023-10-23) | ||
@@ -8,0 +25,0 @@ |
@@ -1,4 +0,2 @@ | ||
import { globalAlwatr } from './global-alwatr.js'; | ||
import type { AlwatrLogger } from './type.js'; | ||
export { type AlwatrLogger, globalAlwatr }; | ||
export declare const NODE_MODE: boolean; | ||
@@ -5,0 +3,0 @@ export declare const DEV_MODE: boolean; |
@@ -1,7 +0,1 @@ | ||
import { globalAlwatr } from './global-alwatr.js'; | ||
export { globalAlwatr }; | ||
globalAlwatr.registeredList.push({ | ||
name: '@alwatr/logger', | ||
version: _ALWATR_VERSION_, | ||
}); | ||
export const NODE_MODE = typeof process !== 'undefined'; | ||
@@ -82,4 +76,4 @@ export const DEV_MODE = NODE_MODE | ||
accident: NODE_MODE | ||
? console.warn.bind(console, `${styleScope}⚠️\n%s\x1b[33m.%s() Accident \`%s\` %s!${_style.reset}`, domain) | ||
: console.warn.bind(console, '%c%s%c.%s() Accident `%s` %s!', styleScope, domain, _style.reset), | ||
? console.warn.bind(console, `${styleScope}⚠️\n%s\x1b[33m.%s() Accident \`%s\`!${_style.reset}`, domain) | ||
: console.warn.bind(console, '%c%s%c.%s() Accident `%s`!', styleScope, domain, _style.reset), | ||
error: NODE_MODE | ||
@@ -102,4 +96,4 @@ ? console.error.bind(console, `${styleScope}❌\n%s\x1b[31m.%s() Error \`%s\`${_style.reset}\n`, domain) | ||
incident: NODE_MODE | ||
? console.log.bind(console, `${styleScope}🚸\n%s${_style.reset}.%s() Incident \`%s\` %s!${_style.reset}`, domain) | ||
: console.log.bind(console, '%c%s%c.%s() Incident `%s` %s!', styleScope, domain, 'color: orange;'), | ||
? console.log.bind(console, `${styleScope}🚸\n%s${_style.reset}.%s() Incident \`%s\`!${_style.reset}`, domain) | ||
: console.log.bind(console, '%c%s%c.%s() Incident `%s`!', styleScope, domain, 'color: orange;'), | ||
time: (label) => console.time(domain + '.' + label + ' duration time'), | ||
@@ -106,0 +100,0 @@ timeEnd: (label) => console.timeEnd(domain + '.' + label + ' duration time'), |
{ | ||
"name": "@alwatr/logger", | ||
"version": "1.2.0", | ||
"version": "2.0.0", | ||
"description": "Fancy colorful console debugger with custom scope written in tiny TypeScript, ES module.", | ||
@@ -14,5 +14,5 @@ "keywords": [ | ||
], | ||
"main": "logger.js", | ||
"main": "index.js", | ||
"type": "module", | ||
"types": "logger.d.ts", | ||
"types": "index.d.ts", | ||
"author": "S. Ali Mihandoost <ali.mihandoost@gmail.com> (https://ali.mihandoost.com)", | ||
@@ -36,6 +36,5 @@ "license": "MIT", | ||
"dependencies": { | ||
"@alwatr/type": "^1.1.4", | ||
"tslib": "^2.6.2" | ||
}, | ||
"gitHead": "26313bbc24641dcfdaa3a0f94159218e634f390d" | ||
"gitHead": "66a820931d638c8e4b465c86bf5c6ad0771d62ad" | ||
} |
@@ -0,1 +1,7 @@ | ||
export interface GlobalAlwatr { | ||
packages: Record<string, string>; | ||
} | ||
declare global { | ||
var Alwatr: GlobalAlwatr; | ||
} | ||
export interface AlwatrLogger { | ||
@@ -75,6 +81,6 @@ /** | ||
* ```ts | ||
* logger.incident?.('fetch', 'abort_signal', 'aborted signal received', {url: '/test.json'}); | ||
* logger.incident?.('fetch', 'abort_signal', {url: '/test.json'}); | ||
* ``` | ||
*/ | ||
incident?(method: string, code: string, desc: string, ...args: unknown[]): void; | ||
incident?(method: string, code: string, ...args: unknown[]): void; | ||
/** | ||
@@ -86,6 +92,6 @@ * `console.warn` an unexpected accident or error that you handled like warning. | ||
* ```ts | ||
* logger.accident('fetch', 'file_not_found', 'url requested return 404 not found', {url: '/test.json'}); | ||
* logger.accident('fetch', 'file_not_found', {url: '/test.json'}); | ||
* ``` | ||
*/ | ||
accident(method: string, code: string, desc: string, ...args: unknown[]): void; | ||
accident(method: string, code: string, ...args: unknown[]): void; | ||
/** | ||
@@ -92,0 +98,0 @@ * `console.error` an unexpected error. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
41957
1
20
291
0
- Removed@alwatr/type@^1.1.4
- Removed@alwatr/type@1.2.4(transitive)