@betterer/logger
Advanced tools
Comparing version 0.5.0 to 1.0.0
@@ -1,1 +0,2 @@ | ||
export * from './logger'; | ||
export { br, code, error, info, logo, overwrite, success, warn } from './logger'; | ||
export * from './types'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./logger"), exports); | ||
var logger_1 = require("./logger"); | ||
exports.br = logger_1.br; | ||
exports.code = logger_1.code; | ||
exports.error = logger_1.error; | ||
exports.info = logger_1.info; | ||
exports.logo = logger_1.logo; | ||
exports.overwrite = logger_1.overwrite; | ||
exports.success = logger_1.success; | ||
exports.warn = logger_1.warn; | ||
//# sourceMappingURL=index.js.map |
@@ -1,19 +0,9 @@ | ||
export declare function mute(): void; | ||
export declare function header(head: string): void; | ||
import { BettererLogger, BettererLoggerCodeInfo, BettererLoggerOverwriteDone } from './types'; | ||
export declare function logo(): void; | ||
export declare function br(): void; | ||
export declare const success: (...args: string[]) => void; | ||
export declare const info: (...args: string[]) => void; | ||
export declare const warn: (...args: string[]) => void; | ||
export declare const error: (...args: string[]) => void; | ||
export declare const code: (codeInfo: LoggerCodeInfo) => void; | ||
export declare type LoggerCodeInfo = { | ||
message: string; | ||
filePath: string; | ||
fileText: string; | ||
start: number; | ||
end: number; | ||
}; | ||
export declare type LoggerCodeLocation = { | ||
line: number; | ||
column: number; | ||
}; | ||
export declare const success: BettererLogger; | ||
export declare const info: BettererLogger; | ||
export declare const warn: BettererLogger; | ||
export declare const error: BettererLogger; | ||
export declare const code: (codeInfo: BettererLoggerCodeInfo) => void; | ||
export declare function overwrite(content: string): BettererLoggerOverwriteDone; |
@@ -5,14 +5,14 @@ "use strict"; | ||
var code_frame_1 = require("@babel/code-frame"); | ||
var chalk_1 = require("chalk"); | ||
var chalk = require("chalk"); | ||
var logUpdate = require("log-update"); | ||
var lines_and_columns_1 = require("lines-and-columns"); | ||
var path = require("path"); | ||
var ERROR_BLOCK = chalk.bgRed(' '); | ||
var IS_JS_REGEXP = /.t|jsx?$/; | ||
function mute() { | ||
console['log'] = function () { }; | ||
var LOGO = chalk.yellowBright("\n \\ | / _ _ _ \n '-.ooo.-' | |__ ___| |_| |_ ___ _ __ ___ _ __ \n---ooooo--- | '_ \\ / _ \\ __| __/ _ \\ '__/ _ \\ '__|\n .-'ooo'-. | |_) | __/ |_| || __/ | | __/ | \n / | \\ |_.__/ \\___|\\__|\\__\\___|_| \\___|_| \n "); | ||
var NEW_LINE = '\n'; | ||
function logo() { | ||
console.log(LOGO); | ||
} | ||
exports.mute = mute; | ||
function header(head) { | ||
console.log(chalk_1.default.yellowBright(head)); | ||
} | ||
exports.header = header; | ||
exports.logo = logo; | ||
function br() { | ||
@@ -22,9 +22,9 @@ console.log(''); | ||
exports.br = br; | ||
var HEADING = chalk_1.default.bgBlack.yellowBright.bold(" \u2600\uFE0F betterer "); | ||
var HEADING = chalk.bgBlack.yellowBright.bold(" \u2600\uFE0F betterer "); | ||
var previousLogger = 'LOG'; | ||
exports.success = createLogger(chalk_1.default.bgGreenBright.black(' succ '), chalk_1.default.bgBlack(' ✅ ')); | ||
exports.info = createLogger(chalk_1.default.bgWhiteBright.black(' info '), chalk_1.default.bgBlack(' 💬 ')); | ||
exports.warn = createLogger(chalk_1.default.bgYellowBright.black(' warn '), chalk_1.default.bgBlack(' ⚠️ ')); | ||
exports.error = createLogger(chalk_1.default.bgRedBright.white(' erro '), chalk_1.default.bgBlack(' 🔥 ')); | ||
var SPACER = chalk_1.default.bgBlack.yellowBright(' - '); | ||
exports.success = createLogger(chalk.bgGreenBright.black(' succ '), chalk.bgBlack(' ✅ ')); | ||
exports.info = createLogger(chalk.bgWhiteBright.black(' info '), chalk.bgBlack(' 💬 ')); | ||
exports.warn = createLogger(chalk.bgYellowBright.black(' warn '), chalk.bgBlack(' ⚠️ ')); | ||
exports.error = createLogger(chalk.bgRedBright.white(' erro '), chalk.bgBlack(' 🔥 ')); | ||
var SPACER = chalk.bgBlack.yellowBright(' - '); | ||
function createLogger(name, icon) { | ||
@@ -39,3 +39,3 @@ return function () { | ||
} | ||
console.log.apply(console, tslib_1.__spreadArrays(["" + HEADING + name + icon + SPACER], messages.map(function (m) { return chalk_1.default.whiteBright(m); }))); | ||
console.log.apply(console, tslib_1.__spreadArrays(["" + HEADING + name + icon + SPACER], messages.map(function (m) { return chalk.whiteBright(m); }))); | ||
previousLogger = 'LOG'; | ||
@@ -62,5 +62,11 @@ }; | ||
var codeFrame = code_frame_1.codeFrameColumns(fileText, { start: start, end: end }, options); | ||
console.log("\n" + chalk_1.default.bgRed(' ') + chalk_1.default.bgBlack.white(" " + message + " \n") + codeFrame); | ||
var codeMessage = chalk.bgBlack.white(" " + message + " " + NEW_LINE); | ||
console.log("" + NEW_LINE + ERROR_BLOCK + codeMessage + codeFrame); | ||
previousLogger = 'CODE'; | ||
}; | ||
function overwrite(content) { | ||
logUpdate("" + LOGO + NEW_LINE + content); | ||
return logUpdate.done.bind(logUpdate); | ||
} | ||
exports.overwrite = overwrite; | ||
//# sourceMappingURL=logger.js.map |
{ | ||
"name": "@betterer/logger", | ||
"description": "logger for @betterer/betterer", | ||
"version": "0.5.0", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
@@ -28,4 +28,5 @@ "publishConfig": { | ||
"@babel/code-frame": "^7.5.5", | ||
"chalk": "^2.4.2", | ||
"chalk": "^4.0.0", | ||
"lines-and-columns": "^1.1.6", | ||
"log-update": "^4.0.0", | ||
"npmlog": "^4.1.2", | ||
@@ -38,3 +39,3 @@ "tslib": "^1.10.0" | ||
}, | ||
"gitHead": "34f5170cce39e8dd684158066243d36b9e27aeb6" | ||
"gitHead": "1ce8729fb53a9a138624c2d30282092bbe931ddf" | ||
} |
@@ -1,2 +0,2 @@ | ||
[![betterer](https://github.com/phenomnomnominal/betterer/blob/master/docs/logo.png)](https://phenomnomnominal.github.io/betterer/) | ||
[![Betterer](https://raw.githubusercontent.com/phenomnomnominal/betterer/master/docs/logo.png)](https://phenomnomnominal.github.io/betterer/) | ||
@@ -7,3 +7,3 @@ # `@betterer/logger` | ||
Logger used within [**`betterer`**](https://github.com/phenomnomnominal/betterer). | ||
Logger used within [**`Betterer`**](https://github.com/phenomnomnominal/betterer). | ||
@@ -44,2 +44,4 @@ ## Usage | ||
```typescript | ||
import { info } from '@betterer/logger'; | ||
info('message'); | ||
@@ -55,2 +57,4 @@ ``` | ||
```typescript | ||
import { success } from '@betterer/logger'; | ||
success('message'); | ||
@@ -66,2 +70,4 @@ ``` | ||
```typescript | ||
import { warn } from '@betterer/logger'; | ||
warn('message'); | ||
@@ -68,0 +74,0 @@ ``` |
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
11060
12
102
0
75
6
+ Addedlog-update@^4.0.0
+ Addedansi-escapes@4.3.2(transitive)
+ Addedansi-regex@5.0.1(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedastral-regex@2.0.0(transitive)
+ Addedchalk@4.1.2(transitive)
+ Addedcli-cursor@3.1.0(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedemoji-regex@8.0.0(transitive)
+ Addedhas-flag@4.0.0(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedlog-update@4.0.0(transitive)
+ Addedmimic-fn@2.1.0(transitive)
+ Addedonetime@5.1.2(transitive)
+ Addedrestore-cursor@3.1.0(transitive)
+ Addedslice-ansi@4.0.0(transitive)
+ Addedstring-width@4.2.3(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
+ Addedsupports-color@7.2.0(transitive)
+ Addedtype-fest@0.21.3(transitive)
+ Addedwrap-ansi@6.2.0(transitive)
- Removedansi-styles@3.2.1(transitive)
- Removedchalk@2.4.2(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedsupports-color@5.5.0(transitive)
Updatedchalk@^4.0.0