@userfrosting/ts-log-adapter-gulplog
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -10,2 +10,7 @@ # Changelog | ||
## [0.2.0] - 2020-04-23 | ||
### Added | ||
- Optional prefix annotation. | ||
## [0.1.0] - 2020-04-23 | ||
@@ -12,0 +17,0 @@ |
@@ -11,7 +11,12 @@ /** | ||
export declare class GulpLogLogger implements Logger { | ||
trace(message?: any, ...optionalParams: any[]): void; | ||
debug(message?: any, ...optionalParams: any[]): void; | ||
info(message?: any, ...optionalParams: any[]): void; | ||
warn(message?: any, ...optionalParams: any[]): void; | ||
error(message?: any, ...optionalParams: any[]): void; | ||
private prefix; | ||
/** | ||
* @param prefix - Optionally annotate logs with a prefix such as the package name to identify log source. | ||
*/ | ||
constructor(prefix?: string); | ||
trace: (message?: any, ...optionalParams: any[]) => void; | ||
debug: (message?: any, ...optionalParams: any[]) => void; | ||
info: (message?: any, ...optionalParams: any[]) => void; | ||
warn: (message?: any, ...optionalParams: any[]) => void; | ||
error: (message?: any, ...optionalParams: any[]) => void; | ||
} |
@@ -6,3 +6,3 @@ /** | ||
import * as GulpLog from "gulplog"; | ||
function log(logFn, message, args) { | ||
function log(prefix, logFn, message, args) { | ||
// Handle args | ||
@@ -15,18 +15,18 @@ let processedArgs = null; | ||
// Handle message | ||
let processedMessage; | ||
let processedMessage = prefix; | ||
if (typeof message === "string") { | ||
// All is well | ||
processedMessage = message; | ||
processedMessage += message; | ||
} | ||
else if (typeof message === "undefined") { | ||
// Make it clear the message is undefined | ||
processedMessage = "(undefined)"; | ||
processedMessage += "(undefined)"; | ||
} | ||
else if (message === null) { | ||
// Make it clear the message is null | ||
processedMessage = "(null)"; | ||
processedMessage += "(null)"; | ||
} | ||
else { | ||
// Final case, stringify it | ||
processedMessage = JSON.stringify(message); | ||
processedMessage += JSON.stringify(message); | ||
} | ||
@@ -47,22 +47,33 @@ if (processedArgs) { | ||
export class GulpLogLogger { | ||
trace(message, ...optionalParams) { | ||
// Trace doesn't exist in gulplog so we need to note the actual log level and throw into debug | ||
function traceDecorate(message, ...args) { | ||
GulpLog.debug(`TRACE: ${message}`, ...args); | ||
/** | ||
* @param prefix - Optionally annotate logs with a prefix such as the package name to identify log source. | ||
*/ | ||
constructor(prefix) { | ||
this.trace = (message, ...optionalParams) => { | ||
// Trace doesn't exist in gulplog so we need to note the actual log level and throw into debug | ||
function traceDecorate(message, ...args) { | ||
GulpLog.debug(`TRACE ${message}`, ...args); | ||
} | ||
log(this.prefix, traceDecorate, message, optionalParams); | ||
}; | ||
this.debug = (message, ...optionalParams) => { | ||
log(this.prefix, GulpLog.debug, message, optionalParams); | ||
}; | ||
this.info = (message, ...optionalParams) => { | ||
log(this.prefix, GulpLog.info, message, optionalParams); | ||
}; | ||
this.warn = (message, ...optionalParams) => { | ||
log(this.prefix, GulpLog.warn, message, optionalParams); | ||
}; | ||
this.error = (message, ...optionalParams) => { | ||
log(this.prefix, GulpLog.error, message, optionalParams); | ||
}; | ||
if (prefix) { | ||
this.prefix = `${prefix}: `; | ||
} | ||
log(traceDecorate, message, optionalParams); | ||
else { | ||
this.prefix = ""; | ||
} | ||
} | ||
debug(message, ...optionalParams) { | ||
log(GulpLog.debug, message, optionalParams); | ||
} | ||
info(message, ...optionalParams) { | ||
log(GulpLog.info, message, optionalParams); | ||
} | ||
warn(message, ...optionalParams) { | ||
log(GulpLog.warn, message, optionalParams); | ||
} | ||
error(message, ...optionalParams) { | ||
log(GulpLog.error, message, optionalParams); | ||
} | ||
} | ||
//# sourceMappingURL=main.js.map |
@@ -0,0 +0,0 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard. |
@@ -11,12 +11,13 @@ ## API Report File for "@userfrosting/ts-log-adapter-gulplog" | ||
export class GulpLogLogger implements Logger { | ||
constructor(prefix?: string); | ||
// (undocumented) | ||
debug(message?: any, ...optionalParams: any[]): void; | ||
debug: (message?: any, ...optionalParams: any[]) => void; | ||
// (undocumented) | ||
error(message?: any, ...optionalParams: any[]): void; | ||
error: (message?: any, ...optionalParams: any[]) => void; | ||
// (undocumented) | ||
info(message?: any, ...optionalParams: any[]): void; | ||
info: (message?: any, ...optionalParams: any[]) => void; | ||
// (undocumented) | ||
trace(message?: any, ...optionalParams: any[]): void; | ||
trace: (message?: any, ...optionalParams: any[]) => void; | ||
// (undocumented) | ||
warn(message?: any, ...optionalParams: any[]): void; | ||
warn: (message?: any, ...optionalParams: any[]) => void; | ||
} | ||
@@ -23,0 +24,0 @@ |
@@ -5,3 +5,3 @@ <!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
## GulpLogLogger.debug() method | ||
## GulpLogLogger.debug property | ||
@@ -11,15 +11,3 @@ <b>Signature:</b> | ||
```typescript | ||
debug(message?: any, ...optionalParams: any[]): void; | ||
debug: (message?: any, ...optionalParams: any[]) => void; | ||
``` | ||
## Parameters | ||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| message | <code>any</code> | | | ||
| optionalParams | <code>any[]</code> | | | ||
<b>Returns:</b> | ||
`void` | ||
@@ -5,3 +5,3 @@ <!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
## GulpLogLogger.error() method | ||
## GulpLogLogger.error property | ||
@@ -11,15 +11,3 @@ <b>Signature:</b> | ||
```typescript | ||
error(message?: any, ...optionalParams: any[]): void; | ||
error: (message?: any, ...optionalParams: any[]) => void; | ||
``` | ||
## Parameters | ||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| message | <code>any</code> | | | ||
| optionalParams | <code>any[]</code> | | | ||
<b>Returns:</b> | ||
`void` | ||
@@ -5,3 +5,3 @@ <!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
## GulpLogLogger.info() method | ||
## GulpLogLogger.info property | ||
@@ -11,15 +11,3 @@ <b>Signature:</b> | ||
```typescript | ||
info(message?: any, ...optionalParams: any[]): void; | ||
info: (message?: any, ...optionalParams: any[]) => void; | ||
``` | ||
## Parameters | ||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| message | <code>any</code> | | | ||
| optionalParams | <code>any[]</code> | | | ||
<b>Returns:</b> | ||
`void` | ||
@@ -15,11 +15,17 @@ <!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
## Methods | ||
## Constructors | ||
| Method | Modifiers | Description | | ||
| Constructor | Modifiers | Description | | ||
| --- | --- | --- | | ||
| [debug(message, optionalParams)](./ts-log-adapter-gulplog.gulploglogger.debug.md) | | | | ||
| [error(message, optionalParams)](./ts-log-adapter-gulplog.gulploglogger.error.md) | | | | ||
| [info(message, optionalParams)](./ts-log-adapter-gulplog.gulploglogger.info.md) | | | | ||
| [trace(message, optionalParams)](./ts-log-adapter-gulplog.gulploglogger.trace.md) | | | | ||
| [warn(message, optionalParams)](./ts-log-adapter-gulplog.gulploglogger.warn.md) | | | | ||
| [(constructor)(prefix)](./ts-log-adapter-gulplog.gulploglogger._constructor_.md) | | Constructs a new instance of the <code>GulpLogLogger</code> class | | ||
## Properties | ||
| Property | Modifiers | Type | Description | | ||
| --- | --- | --- | --- | | ||
| [debug](./ts-log-adapter-gulplog.gulploglogger.debug.md) | | <code>(message?: any, ...optionalParams: any[]) => void</code> | | | ||
| [error](./ts-log-adapter-gulplog.gulploglogger.error.md) | | <code>(message?: any, ...optionalParams: any[]) => void</code> | | | ||
| [info](./ts-log-adapter-gulplog.gulploglogger.info.md) | | <code>(message?: any, ...optionalParams: any[]) => void</code> | | | ||
| [trace](./ts-log-adapter-gulplog.gulploglogger.trace.md) | | <code>(message?: any, ...optionalParams: any[]) => void</code> | | | ||
| [warn](./ts-log-adapter-gulplog.gulploglogger.warn.md) | | <code>(message?: any, ...optionalParams: any[]) => void</code> | | | ||
@@ -5,3 +5,3 @@ <!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
## GulpLogLogger.trace() method | ||
## GulpLogLogger.trace property | ||
@@ -11,15 +11,3 @@ <b>Signature:</b> | ||
```typescript | ||
trace(message?: any, ...optionalParams: any[]): void; | ||
trace: (message?: any, ...optionalParams: any[]) => void; | ||
``` | ||
## Parameters | ||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| message | <code>any</code> | | | ||
| optionalParams | <code>any[]</code> | | | ||
<b>Returns:</b> | ||
`void` | ||
@@ -5,3 +5,3 @@ <!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
## GulpLogLogger.warn() method | ||
## GulpLogLogger.warn property | ||
@@ -11,15 +11,3 @@ <b>Signature:</b> | ||
```typescript | ||
warn(message?: any, ...optionalParams: any[]): void; | ||
warn: (message?: any, ...optionalParams: any[]) => void; | ||
``` | ||
## Parameters | ||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| message | <code>any</code> | | | ||
| optionalParams | <code>any[]</code> | | | ||
<b>Returns:</b> | ||
`void` | ||
{ | ||
"name": "@userfrosting/ts-log-adapter-gulplog", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "An adapter for the ts-log interface that pushes logging to gulplog with optional arguments JSON encoded.", | ||
@@ -14,10 +14,14 @@ "funding": "https://opencollective.com/userfrosting", | ||
"scripts": { | ||
"pretest": "tsc && api-extractor run --local", | ||
"test": "nyc --reporter=text ava", | ||
"prepublishOnly": "tsc", | ||
"preversion": "npm test", | ||
"version": "npm run version:apiDocRefresh && npm run version:changelogBump", | ||
"postversion": "git push && git push --tags", | ||
"version:changelogBump": "changelog-updater && git add CHANGELOG.md", | ||
"version:apiDocRefresh": "api-extractor run && api-documenter markdown -i ./temp -o ./docs/api && git add ./docs/api/*" | ||
"aeCheck": "api-extractor run", | ||
"aeUpdate": "api-extractor run --local", | ||
"purgeDocs": "del-cli ./docs/api/", | ||
"adUpdate": "npm run purgeDocs && api-documenter markdown -i ./temp -o ./docs/api", | ||
"build": "is-ci && npm run build:release || npm run build:dev", | ||
"build:dev": "tsc && npm run aeUpdate && npm run adUpdate", | ||
"build:release": "tsc && npm run aeCheck", | ||
"pretest": "npm run build", | ||
"test": "is-ci && ava || nyc --reporter=text ava", | ||
"prepublishOnly": "npm run build:release && npm run test", | ||
"version": "changelog-updater && git add CHANGELOG.md", | ||
"postversion": "git push && git push --tags" | ||
}, | ||
@@ -49,3 +53,5 @@ "author": "Jordan Mele <SiliconSoldier@outlook.com.au> (https://djmm.me/)", | ||
"changelog-updater": "^1.1.0", | ||
"del-cli": "^3.0.0", | ||
"glogg": "^1.0.2", | ||
"is-ci": "^2.0.0", | ||
"nyc": "^15.0.1", | ||
@@ -52,0 +58,0 @@ "typescript": "^3.8.3" |
@@ -1,2 +0,2 @@ | ||
# [gulp](https://github.com/gulpjs/gulp)-bundle-assets | ||
# ts-log-adapter-gulplog | ||
@@ -3,0 +3,0 @@ | Branch | Status | |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20774
34
23
167
10