@turbowarp/nanolog 0.2.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser.js +19 -0
- package/index.d.ts +25 -0
- package/package.json +9 -2
package/browser.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const createLog = (namespace = '') => {
|
|
2
|
+
const log = (childNamespace) => createLog(namespace ? `${namespace} ${childNamespace}` : childNamespace);
|
|
3
|
+
|
|
4
|
+
const formattedNamespace = namespace ? [namespace] : [];
|
|
5
|
+
|
|
6
|
+
log.debug = log.log = console.debug.bind(console, ...formattedNamespace, 'debug');
|
|
7
|
+
log.info = console.log.bind(console, ...formattedNamespace, 'info')
|
|
8
|
+
log.warn = log.warning = console.warn.bind(console, ...formattedNamespace, 'warn')
|
|
9
|
+
log.error = console.error.bind(console, ...formattedNamespace, 'error');
|
|
10
|
+
|
|
11
|
+
return log;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated does nothing
|
|
16
|
+
*/
|
|
17
|
+
createLog.enable = createLog.disable = () => {};
|
|
18
|
+
|
|
19
|
+
module.exports = createLog;
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface Logger {
|
|
2
|
+
(childNamespace: string): Logger;
|
|
3
|
+
debug: (...args: any[]) => void;
|
|
4
|
+
log: (...args: any[]) => void;
|
|
5
|
+
info: (...args: any[]) => void;
|
|
6
|
+
warn: (...args: any[]) => void;
|
|
7
|
+
warning: (...args: any[]) => void;
|
|
8
|
+
error: (...args: any[]) => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface CreateLog {
|
|
12
|
+
(namespace?: string): Logger;
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated does nothing
|
|
15
|
+
*/
|
|
16
|
+
enable: () => void;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated does nothing
|
|
19
|
+
*/
|
|
20
|
+
disable: () => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const createLog: CreateLog;
|
|
24
|
+
|
|
25
|
+
export = createLog;
|
package/package.json
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turbowarp/nanolog",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "minilog replacement for TurboWarp.",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"browser": "browser.js",
|
|
7
|
+
"types": "index.d.ts",
|
|
6
8
|
"scripts": {
|
|
7
9
|
"test": "node test"
|
|
8
10
|
},
|
|
11
|
+
"homepage": "https://github.com/TurboWarp/nanolog",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/TurboWarp/nanolog.git"
|
|
15
|
+
},
|
|
9
16
|
"author": "GarboMuffin",
|
|
10
17
|
"license": "MIT"
|
|
11
18
|
}
|