@ayana/logger
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -12,3 +12,3 @@ import { Formatter } from '../formatter'; | ||
formatter: Formatter; | ||
transports: Transport<any>[]; | ||
transports: Array<Transport<any>>; | ||
constructor(); | ||
@@ -15,0 +15,0 @@ disableDefaultTransport(): void; |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
@@ -16,4 +18,2 @@ * Copyright 2018 - 2019 Ayana Developers <devs@ayana.io> | ||
*/ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const formatter_1 = require("../formatter"); | ||
@@ -20,0 +20,0 @@ const transports_1 = require("../transports"); |
@@ -0,1 +1,6 @@ | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
@@ -16,9 +21,4 @@ * Copyright 2018 - 2019 Ayana Developers <devs@ayana.io> | ||
*/ | ||
'use strict'; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./Config")); | ||
__export(require("./V1")); | ||
//# sourceMappingURL=index.js.map |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
@@ -16,4 +18,2 @@ * Copyright 2018 - 2019 Ayana Developers <devs@ayana.io> | ||
*/ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const constants_1 = require("../constants"); | ||
@@ -20,0 +20,0 @@ var V1LogLevel; |
@@ -0,1 +1,6 @@ | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
@@ -16,7 +21,2 @@ * Copyright 2018 - 2019 Ayana Developers <devs@ayana.io> | ||
*/ | ||
'use strict'; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./LogLevel")); | ||
@@ -23,0 +23,0 @@ __export(require("./LogLevelColor")); |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
@@ -16,4 +18,2 @@ * Copyright 2018 - 2019 Ayana Developers <devs@ayana.io> | ||
*/ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var LogLevel; | ||
@@ -20,0 +20,0 @@ (function (LogLevel) { |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
@@ -16,4 +18,2 @@ * Copyright 2018 - 2019 Ayana Developers <devs@ayana.io> | ||
*/ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var LogLevelColor; | ||
@@ -20,0 +20,0 @@ (function (LogLevelColor) { |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
@@ -16,4 +18,2 @@ * Copyright 2018 - 2019 Ayana Developers <devs@ayana.io> | ||
*/ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var LogLevelValue; | ||
@@ -20,0 +20,0 @@ (function (LogLevelValue) { |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
@@ -16,6 +18,3 @@ * Copyright 2018 - 2019 Ayana Developers <devs@ayana.io> | ||
*/ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const fecha = require('fecha'); | ||
const errors_1 = require("@ayana/errors"); | ||
let genericError; | ||
@@ -51,2 +50,3 @@ try { | ||
const timestamp = fecha.format(Date.now(), this.options.dateFormat); | ||
// tslint:disable-next-line: no-magic-numbers | ||
const coloredLevel = this.logColorer.get(constants_1.LogLevelColor[meta.level], meta.level.padEnd(6)); | ||
@@ -79,4 +79,4 @@ const location = `[${this.logColorer.green(`${meta.origin.packageName}:`)}${this.logColorer.blue(`${meta.origin.packagePath}${meta.origin.name}`)}${meta.uniqueMarker ? `/${this.logColorer.gray(`${meta.uniqueMarker}`)}` : ''}]`; | ||
let coloredError = error.stack; | ||
if (error instanceof errors_1.GenericError && error.hasCode()) { | ||
coloredError = coloredError.replace(`${error.name}:`, `${error.name}: (${this.errorColorer.magenta('' + error.getCode())})`); | ||
if (error instanceof genericError && error.hasCode()) { | ||
coloredError = coloredError.replace(`${error.name}:`, `${error.name}: (${this.errorColorer.magenta(String(error.getCode()))})`); | ||
} | ||
@@ -83,0 +83,0 @@ return coloredError |
@@ -1,17 +0,2 @@ | ||
/* | ||
* Copyright 2018 - 2019 Ayana Developers <devs@ayana.io> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
'use strict'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -18,0 +3,0 @@ class Formatter { |
@@ -0,1 +1,6 @@ | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
@@ -16,9 +21,4 @@ * Copyright 2018 - 2019 Ayana Developers <devs@ayana.io> | ||
*/ | ||
'use strict'; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./DefaultFormatter")); | ||
__export(require("./Formatter")); | ||
//# sourceMappingURL=index.js.map |
@@ -0,1 +1,6 @@ | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
@@ -16,7 +21,2 @@ * Copyright 2018 - 2019 Ayana Developers <devs@ayana.io> | ||
*/ | ||
'use strict'; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const Logger_1 = require("./Logger"); | ||
@@ -23,0 +23,0 @@ exports.Logger = Logger_1.Logger; |
@@ -8,3 +8,3 @@ import { LogLevel } from './constants'; | ||
export declare class Logger { | ||
private static detector; | ||
private static readonly detector; | ||
/** | ||
@@ -11,0 +11,0 @@ * The name of the current logger. This is derived from the argument in Logger.get(). |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
@@ -16,4 +18,2 @@ * Copyright 2018 - 2019 Ayana Developers <devs@ayana.io> | ||
*/ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const path = require("path"); | ||
@@ -150,5 +150,5 @@ const config_1 = require("./config"); | ||
throw new Error('Logger.get(): Invalid forClass parameter. Use a string or a named function'); | ||
const callerDirectory = this.detector.getCallerDirectory(); | ||
const projectRoot = this.detector.getRootOf(callerDirectory); | ||
const pkg = this.detector.getInfo(projectRoot); | ||
const callerDirectory = Logger.detector.getCallerDirectory(); | ||
const projectRoot = Logger.detector.getRootOf(callerDirectory); | ||
const pkg = Logger.detector.getInfo(projectRoot); | ||
let pkgMain = ''; | ||
@@ -155,0 +155,0 @@ if (pkg.loggerBase != null) |
@@ -1,18 +0,3 @@ | ||
/* | ||
* Copyright 2018 - 2019 Ayana Developers <devs@ayana.io> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
'use strict'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=LogMeta.js.map |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
@@ -16,4 +18,2 @@ * Copyright 2018 - 2019 Ayana Developers <devs@ayana.io> | ||
*/ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const os = require("os"); | ||
@@ -24,6 +24,3 @@ const constants_1 = require("../constants"); | ||
constructor(options = {}) { | ||
options = Object.assign({ | ||
eol: os.EOL, | ||
stderrMinLevel: constants_1.LogLevel.WARN, | ||
}, options); | ||
options = Object.assign({ eol: os.EOL, stderrMinLevel: constants_1.LogLevel.WARN }, options); | ||
super(options); | ||
@@ -30,0 +27,0 @@ } |
@@ -13,6 +13,6 @@ import { LogMeta } from '../LogMeta'; | ||
export declare class HTTPTransport extends Transport<HTTPTransportOptions> { | ||
private buffer; | ||
private lastFlush; | ||
private readonly buffer; | ||
private readonly lastFlush; | ||
constructor(options: HTTPTransportOptions); | ||
prepareRequest(messages: HTTPBufferMessage[]): { | ||
prepareRequest(messages: Array<HTTPBufferMessage>): { | ||
body: { | ||
@@ -19,0 +19,0 @@ messages: HTTPBufferMessage[]; |
@@ -1,17 +0,2 @@ | ||
/* | ||
* Copyright 2018 - 2019 Ayana Developers <devs@ayana.io> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
'use strict'; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -21,6 +6,3 @@ const Transport_1 = require("./Transport"); | ||
constructor(options) { | ||
options = Object.assign({}, { | ||
endpoint: null, | ||
flushInterval: 0, | ||
}, options || {}); | ||
options = Object.assign({ endpoint: null, flushInterval: 0 }, (options || {})); | ||
super(options); | ||
@@ -27,0 +9,0 @@ if (this.options.endpoint == null) |
@@ -0,1 +1,6 @@ | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
@@ -16,9 +21,4 @@ * Copyright 2018 - 2019 Ayana Developers <devs@ayana.io> | ||
*/ | ||
'use strict'; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./ConsoleTransport")); | ||
__export(require("./Transport")); | ||
//# sourceMappingURL=index.js.map |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
@@ -16,4 +18,2 @@ * Copyright 2018 - 2019 Ayana Developers <devs@ayana.io> | ||
*/ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const config_1 = require("../config"); | ||
@@ -26,3 +26,3 @@ const constants_1 = require("../constants"); | ||
this.options = {}; | ||
this.options = Object.assign({}, options || {}); | ||
this.options = Object.assign({}, (options || {})); | ||
this.setLevel(options.level); | ||
@@ -29,0 +29,0 @@ this.setFormatter(options.formatter); |
@@ -1,2 +0,3 @@ | ||
'use strict'; | ||
"use strict"; | ||
// tslint:disable: variable-name no-magic-numbers | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -3,0 +4,0 @@ // CodeMap taken from https://github.com/Marak/colors.js/blob/master/lib/styles.js |
@@ -0,1 +1,6 @@ | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
@@ -16,9 +21,4 @@ * Copyright 2018 - 2019 Ayana Developers <devs@ayana.io> | ||
*/ | ||
'use strict'; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./Color")); | ||
__export(require("./PackageDetector")); | ||
//# sourceMappingURL=index.js.map |
export declare class PackageDetector { | ||
private packageCache; | ||
private readonly packageCache; | ||
getRootOf(directory: string): string; | ||
@@ -4,0 +4,0 @@ getInfo(rootDir: string): any; |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
@@ -16,4 +18,2 @@ * Copyright 2018 - 2019 Ayana Developers <devs@ayana.io> | ||
*/ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const fs = require("fs"); | ||
@@ -59,2 +59,3 @@ const path = require("path"); | ||
// 0: Error line, 1: Call to getCallStack(), 2: Call to getCallerDirectory(), 3: Call to our caller | ||
// tslint:disable-next-line: no-magic-numbers | ||
const callerFile = stack[3].getFileName(); | ||
@@ -61,0 +62,0 @@ const callerDirname = path.dirname(callerFile); |
{ | ||
"name": "@ayana/logger", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Useful and great looking logging made easy", | ||
@@ -24,6 +24,6 @@ "repository": "https://gitlab.com/ayana/libs/logger", | ||
"@ayana/test": "^2.0.1", | ||
"@ayana/tslint-config": "^1.1.2", | ||
"@ayana/tslint-config": "^1.2.3", | ||
"@types/node": "^10.14.5", | ||
"tslint": "^5.17.0", | ||
"typescript": "^3.5.2" | ||
"tslint": "^5.18.0", | ||
"typescript": "^3.5.3" | ||
}, | ||
@@ -30,0 +30,0 @@ "license": "Apache-2.0", |
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
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
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
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
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
92425
1396