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