mirror of
https://git.stamm.me/OpenServer/NodeLogging.git
synced 2024-11-10 19:41:03 +00:00
Making it ready for release
This commit is contained in:
parent
03cc58d3e1
commit
0b75f8ddf8
8
package-lock.json
generated
8
package-lock.json
generated
@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "@hibas123/nodelogging",
|
||||
"version": "1.5.0-alpha.2",
|
||||
"version": "1.6.0-alpha.2",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"@hibas123/logging": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@hibas123/logging/-/logging-1.0.1.tgz",
|
||||
"integrity": "sha512-1yAq/Jjziot1tDbXZoi5TDuHkZxGB2hSlEuUkMnejvA60AfycNpTvzGd3ZLJC9fbKZFNxm2HfwW0pdIrecL0WQ==",
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@hibas123/logging/-/logging-1.1.0.tgz",
|
||||
"integrity": "sha512-EaDyvvWDD+SikLgP6WTvTCR6Sk9Kp2BZkDbUk0Rz4pF2B4dGyO8yRI8qhBEtjbMXGqedeM5mQDGgvY5QUDevVg==",
|
||||
"requires": {
|
||||
"@hibas123/utils": "^2.0.2"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hibas123/nodelogging",
|
||||
"version": "1.6.0-alpha.2",
|
||||
"version": "1.6.0",
|
||||
"description": "",
|
||||
"main": "out/index.js",
|
||||
"types": "out/index.d.ts",
|
||||
@ -26,7 +26,7 @@
|
||||
"typescript": "^3.3.4000"
|
||||
},
|
||||
"dependencies": {
|
||||
"@hibas123/logging": "^1.0.1",
|
||||
"@hibas123/logging": "^1.1.0",
|
||||
"@hibas123/utils": "^2.0.2"
|
||||
}
|
||||
}
|
@ -31,10 +31,10 @@ All Logging types except the simple error take as many arguments as you want. Th
|
||||
|
||||
NodeLogging can work without any configuration, but it may be useful to change the log output folder.
|
||||
|
||||
Todo so you are capable of creating own instances of the LoggingExtended class
|
||||
Todo so you are capable of creating own instances of the LoggingBase class
|
||||
|
||||
``` javascript
|
||||
const CustomLogging = new LoggingExtended(name | {
|
||||
const CustomLogging = new LoggingBase(name | {
|
||||
name: "custom", // default undefined
|
||||
files: true | false | { //default true
|
||||
logfile: "./logs/test.log",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { LoggingFiles } from "./filewriter";
|
||||
import { LoggingBase, LoggingBaseOptions } from "@hibas123/logging";
|
||||
import { LoggingBase as LoggingBaseOriginal, LoggingBaseOptions } from "@hibas123/logging";
|
||||
|
||||
|
||||
export interface LoggingOptions extends LoggingBaseOptions {
|
||||
@ -15,7 +15,7 @@ export interface LoggingOptions extends LoggingBaseOptions {
|
||||
}
|
||||
}
|
||||
|
||||
export class LoggingExtended extends LoggingBase {
|
||||
export class LoggingBase extends LoggingBaseOriginal {
|
||||
constructor(config: Partial<LoggingOptions> | string = {}) {
|
||||
super(config);
|
||||
|
||||
@ -42,9 +42,9 @@ export class LoggingExtended extends LoggingBase {
|
||||
}
|
||||
}
|
||||
|
||||
export let Logging: LoggingExtended = undefined;
|
||||
export let Logging: LoggingBase = undefined;
|
||||
if (process.env.LOGGING_NO_DEFAULT !== "true") {
|
||||
Logging = new LoggingExtended();
|
||||
Logging = new LoggingBase();
|
||||
}
|
||||
export default Logging;
|
||||
|
||||
|
10
src/test.ts
10
src/test.ts
@ -1,6 +1,6 @@
|
||||
import { randomBytes } from "crypto";
|
||||
import * as fs from "fs";
|
||||
import { Logging, LoggingExtended } from ".";
|
||||
import { Logging, LoggingBase } from ".";
|
||||
|
||||
const deleteFolderRecursive = function (path: string) {
|
||||
if (fs.existsSync(path)) {
|
||||
@ -29,13 +29,13 @@ Logging.log("\x1b[31m\x1b[31m\x1b[31m\x1b[31m\x1b[31m\x1b[31m TEST \x1b[31m\x1b[
|
||||
let err = new Error()
|
||||
if (typeof err.stack !== "string") console.log("Stacktrace invalid", err.stack)
|
||||
|
||||
let cus = new LoggingExtended({ name: "test" });
|
||||
let cus = new LoggingBase({ name: "test" });
|
||||
cus.log("Hello from custom Logger")
|
||||
|
||||
let cus2 = new LoggingExtended("test2");
|
||||
let cus2 = new LoggingBase("test2");
|
||||
cus2.log("Hello from custom Logger 2")
|
||||
|
||||
let cus22 = new LoggingExtended("test2");
|
||||
let cus22 = new LoggingBase("test2");
|
||||
cus22.log("Hello from custom Logger 22")
|
||||
cus2.log("Hello from custom Logger 2")
|
||||
cus22.log("Hello from custom Logger 22")
|
||||
@ -47,7 +47,7 @@ cus2.log("Hello from custom Logger 2")
|
||||
cus22.log("Hello from custom Logger 22")
|
||||
cus2.log("Hello from custom Logger 2")
|
||||
|
||||
const BenchmarkLogger = new LoggingExtended({
|
||||
const BenchmarkLogger = new LoggingBase({
|
||||
console: false,
|
||||
name: "bench"
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user