Compare commits
2 Commits
1fd8da459b
...
b92caf6468
Author | SHA1 | Date | |
---|---|---|---|
|
b92caf6468 | ||
|
f34800d725 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,4 +2,4 @@ node_modules/
|
||||
logs/
|
||||
yarn.lock
|
||||
out/
|
||||
.history/
|
||||
esm/
|
410
package-lock.json
generated
410
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
@ -1,12 +1,13 @@
|
||||
{
|
||||
"name": "@hibas123/logging",
|
||||
"version": "2.4.4",
|
||||
"version": "2.5.4",
|
||||
"description": "",
|
||||
"main": "out/index.js",
|
||||
"types": "out/index.d.ts",
|
||||
"module": "esm/index.js",
|
||||
"scripts": {
|
||||
"prepublish": "tsc",
|
||||
"build": "tsc",
|
||||
"prepublish": "npm run build",
|
||||
"build": "tsc && tsc -p tsconfig.esm.json",
|
||||
"dev": "nodemon -e ts --exec ts-node src/test.ts"
|
||||
},
|
||||
"repository": {
|
||||
@ -18,16 +19,17 @@
|
||||
"files": [
|
||||
"src/",
|
||||
"out/",
|
||||
"esm/",
|
||||
"tsconfig.json",
|
||||
"readme.md"
|
||||
],
|
||||
"devDependencies": {
|
||||
"concurrently": "^5.1.0",
|
||||
"nodemon": "^2.0.3",
|
||||
"ts-node": "^8.8.2",
|
||||
"typescript": "^3.8.3"
|
||||
"concurrently": "^5.3.0",
|
||||
"nodemon": "^2.0.4",
|
||||
"ts-node": "^9.0.0",
|
||||
"typescript": "^4.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@hibas123/utils": "^2.2.4"
|
||||
"@hibas123/utils": "^2.2.10"
|
||||
}
|
||||
}
|
||||
|
14
src/base.ts
14
src/base.ts
@ -1,6 +1,6 @@
|
||||
import { Observable, ObservableInterface } from "@hibas123/utils";
|
||||
import { ConsoleAdapter } from "./consolewriter";
|
||||
import inspect from "./inspect";
|
||||
import { ConsoleAdapter } from "./consolewriter.js";
|
||||
import inspect from "./inspect.js";
|
||||
import {
|
||||
Adapter,
|
||||
LoggingTypes,
|
||||
@ -12,7 +12,7 @@ import {
|
||||
Colors,
|
||||
FormattedText,
|
||||
FormattedLine,
|
||||
} from "./types";
|
||||
} from "./types.js";
|
||||
|
||||
const browser = typeof window !== "undefined";
|
||||
|
||||
@ -194,11 +194,11 @@ export class LoggingBase {
|
||||
}
|
||||
}
|
||||
|
||||
private $closed = false;
|
||||
#closed = false;
|
||||
|
||||
public close() {
|
||||
if (this.$closed) return;
|
||||
this.$closed = true;
|
||||
if (this.#closed) return;
|
||||
this.#closed = true;
|
||||
|
||||
this.adapterSet.adapters.forEach((adapter) => {
|
||||
let cached = adapterCache.get(adapter);
|
||||
@ -319,7 +319,7 @@ export class LoggingBase {
|
||||
message: any[],
|
||||
caller?: { file: string; line: number; column?: number }
|
||||
) {
|
||||
if (this.$closed) return;
|
||||
if (this.#closed) return;
|
||||
|
||||
let date = new Date().toISOString().replace(/T/, " ").replace(/\..+/, "");
|
||||
|
||||
|
@ -1,14 +1,16 @@
|
||||
import { ObservableInterface } from "@hibas123/utils";
|
||||
import { Colors } from "./index";
|
||||
import { Colors } from "./index.js";
|
||||
import {
|
||||
Adapter,
|
||||
Message,
|
||||
FormattedLine,
|
||||
TerminalFormats,
|
||||
FormatTypes,
|
||||
} from "./types";
|
||||
} from "./types.js";
|
||||
|
||||
const browser = typeof window !== "undefined";
|
||||
declare const Deno: any;
|
||||
|
||||
const browser = typeof window !== "undefined" && typeof Deno === "undefined";
|
||||
|
||||
export class ConsoleAdapter implements Adapter {
|
||||
constructor(private colors: boolean = true) {}
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { LoggingBase } from "./base";
|
||||
export { ConsoleAdapter } from "./consolewriter";
|
||||
import { LoggingBase } from "./base.js";
|
||||
export { ConsoleAdapter } from "./consolewriter.js";
|
||||
export {
|
||||
LoggingBase,
|
||||
LoggingBaseOptions,
|
||||
removeColors,
|
||||
withColor,
|
||||
} from "./base";
|
||||
} from "./base.js";
|
||||
export {
|
||||
Adapter,
|
||||
LoggingTypes,
|
||||
@ -18,7 +18,7 @@ export {
|
||||
Format,
|
||||
FormatTypes,
|
||||
TerminalFormats,
|
||||
} from "./types";
|
||||
} from "./types.js";
|
||||
|
||||
export { ObservableInterface } from "@hibas123/utils";
|
||||
|
||||
|
@ -1,4 +1,10 @@
|
||||
import { Logging, LoggingBase, LoggingTypes, Colors, withColor } from ".";
|
||||
import {
|
||||
Logging,
|
||||
LoggingBase,
|
||||
LoggingTypes,
|
||||
Colors,
|
||||
withColor,
|
||||
} from "./index.js";
|
||||
|
||||
Logging.log("test");
|
||||
Logging.log("i", "am", { a: "an" }, 1000);
|
||||
|
11
tsconfig.esm.json
Normal file
11
tsconfig.esm.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"module": "ESNext",
|
||||
"target": "ES2017",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "esm"
|
||||
},
|
||||
"exclude": ["node_modules"],
|
||||
"include": ["src"]
|
||||
}
|
@ -1,19 +1,13 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es2017",
|
||||
"target": "esnext",
|
||||
"noImplicitAny": false,
|
||||
"sourceMap": true,
|
||||
"outDir": "out",
|
||||
"declaration": true,
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
]
|
||||
"typeRoots": ["node_modules/@types"]
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
],
|
||||
"include": [
|
||||
"src"
|
||||
]
|
||||
"exclude": ["node_modules"],
|
||||
"include": ["src"]
|
||||
}
|
Loading…
Reference in New Issue
Block a user