first commit
This commit is contained in:
7
node_modules/hexo-log/LICENSE
generated
vendored
Normal file
7
node_modules/hexo-log/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
Copyright (c) 2016 Tommy Chen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
49
node_modules/hexo-log/README.md
generated
vendored
Normal file
49
node_modules/hexo-log/README.md
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
# hexo-log
|
||||
|
||||
[](https://github.com/hexojs/hexo-log/actions?query=workflow%3ATester)
|
||||
[](https://www.npmjs.com/package/hexo-log)
|
||||
[](https://coveralls.io/r/hexojs/hexo-log?branch=master)
|
||||
|
||||
Logger for Hexo.
|
||||
|
||||
## Installation
|
||||
|
||||
``` bash
|
||||
$ npm install hexo-log --save
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
``` js
|
||||
// v3.x.x
|
||||
const log = require('hexo-log')({
|
||||
debug: false,
|
||||
silent: false
|
||||
});
|
||||
log.info('Hello world');
|
||||
|
||||
// v4.x.x
|
||||
const log = require('hexo-log').default({
|
||||
debug: false,
|
||||
silent: false
|
||||
});
|
||||
log.info('Hello world');
|
||||
|
||||
// v4.x.x (ES Module)
|
||||
import { logger } from 'hexo-log';
|
||||
|
||||
const log = logger({
|
||||
debug: false,
|
||||
silent: false
|
||||
});
|
||||
log.info('Hello world');
|
||||
```
|
||||
|
||||
Option | Description | Default
|
||||
--- | --- | ---
|
||||
`debug` | Display debug message. | `false`
|
||||
`silent` | Don't display any message in console. | `false`
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
27
node_modules/hexo-log/dist/log.d.ts
generated
vendored
Normal file
27
node_modules/hexo-log/dist/log.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
interface Options {
|
||||
debug?: boolean;
|
||||
silent?: boolean;
|
||||
}
|
||||
declare type ConsoleArgs = any[];
|
||||
declare type writeLogF = (...args: ConsoleArgs) => void;
|
||||
declare class Logger {
|
||||
_silent: boolean;
|
||||
_debug: boolean;
|
||||
level: number;
|
||||
d: writeLogF;
|
||||
i: writeLogF;
|
||||
w: writeLogF;
|
||||
e: writeLogF;
|
||||
log: writeLogF;
|
||||
constructor({ debug, silent }?: Options);
|
||||
_writeLogOutput(level: number, consoleArgs: ConsoleArgs): void;
|
||||
trace(...args: ConsoleArgs): void;
|
||||
debug(...args: ConsoleArgs): void;
|
||||
info(...args: ConsoleArgs): void;
|
||||
warn(...args: ConsoleArgs): void;
|
||||
error(...args: ConsoleArgs): void;
|
||||
fatal(...args: ConsoleArgs): void;
|
||||
}
|
||||
export default function createLogger(options?: Options): Logger;
|
||||
export declare const logger: (option?: Options) => Logger;
|
||||
export {};
|
||||
133
node_modules/hexo-log/dist/log.js
generated
vendored
Normal file
133
node_modules/hexo-log/dist/log.js
generated
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.logger = void 0;
|
||||
const console_1 = require("console");
|
||||
const picocolors_1 = __importDefault(require("picocolors"));
|
||||
const TRACE = 10;
|
||||
const DEBUG = 20;
|
||||
const INFO = 30;
|
||||
const WARN = 40;
|
||||
const ERROR = 50;
|
||||
const FATAL = 60;
|
||||
const LEVEL_NAMES = {
|
||||
10: 'TRACE',
|
||||
20: 'DEBUG',
|
||||
30: 'INFO ',
|
||||
40: 'WARN ',
|
||||
50: 'ERROR',
|
||||
60: 'FATAL'
|
||||
};
|
||||
const LEVEL_COLORS = {
|
||||
10: 'gray',
|
||||
20: 'gray',
|
||||
30: 'green',
|
||||
40: 'bgYellow',
|
||||
50: 'bgRed',
|
||||
60: 'bgRed'
|
||||
};
|
||||
const console = new console_1.Console({
|
||||
stdout: process.stdout,
|
||||
stderr: process.stderr,
|
||||
colorMode: false
|
||||
});
|
||||
class Logger {
|
||||
constructor({ debug = false, silent = false } = {}) {
|
||||
this._silent = silent || false;
|
||||
this._debug = debug || false;
|
||||
this.level = INFO;
|
||||
if (silent) {
|
||||
this.level = FATAL + 10;
|
||||
}
|
||||
if (this._debug) {
|
||||
this.level = TRACE;
|
||||
}
|
||||
}
|
||||
_writeLogOutput(level, consoleArgs) {
|
||||
let errArg;
|
||||
if (typeof consoleArgs[0] === 'object') {
|
||||
errArg = consoleArgs.shift();
|
||||
if (errArg.err && errArg.err instanceof Error) {
|
||||
errArg = errArg.err;
|
||||
}
|
||||
}
|
||||
if (this._debug) {
|
||||
const str = new Date().toISOString().substring(11, 23) + ' ';
|
||||
if (level === TRACE || level >= WARN) {
|
||||
process.stderr.write(picocolors_1.default[LEVEL_COLORS[DEBUG]](str));
|
||||
}
|
||||
else {
|
||||
process.stdout.write(picocolors_1.default[LEVEL_COLORS[DEBUG]](str));
|
||||
}
|
||||
}
|
||||
if (level >= this.level) {
|
||||
const str = picocolors_1.default[LEVEL_COLORS[level]](LEVEL_NAMES[level]) + ' ';
|
||||
if (level === TRACE || level >= WARN) {
|
||||
process.stderr.write(str);
|
||||
}
|
||||
else {
|
||||
process.stdout.write(str);
|
||||
}
|
||||
if (level === TRACE) {
|
||||
console.trace(...consoleArgs);
|
||||
}
|
||||
else if (level < INFO) {
|
||||
console.debug(...consoleArgs);
|
||||
}
|
||||
else if (level < WARN) {
|
||||
console.info(...consoleArgs);
|
||||
}
|
||||
else if (level < ERROR) {
|
||||
console.warn(...consoleArgs);
|
||||
}
|
||||
else {
|
||||
console.error(...consoleArgs);
|
||||
}
|
||||
if (errArg) {
|
||||
const err = errArg.stack || errArg.message;
|
||||
if (err) {
|
||||
const str = picocolors_1.default.yellow(err) + '\n';
|
||||
if (level === TRACE || level >= WARN) {
|
||||
process.stderr.write(str);
|
||||
}
|
||||
else {
|
||||
process.stdout.write(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
trace(...args) {
|
||||
this._writeLogOutput(TRACE, args);
|
||||
}
|
||||
debug(...args) {
|
||||
this._writeLogOutput(DEBUG, args);
|
||||
}
|
||||
info(...args) {
|
||||
this._writeLogOutput(INFO, args);
|
||||
}
|
||||
warn(...args) {
|
||||
this._writeLogOutput(WARN, args);
|
||||
}
|
||||
error(...args) {
|
||||
this._writeLogOutput(ERROR, args);
|
||||
}
|
||||
fatal(...args) {
|
||||
this._writeLogOutput(FATAL, args);
|
||||
}
|
||||
}
|
||||
function createLogger(options = {}) {
|
||||
const logger = new Logger(options);
|
||||
logger.d = logger.debug;
|
||||
logger.i = logger.info;
|
||||
logger.w = logger.warn;
|
||||
logger.e = logger.error;
|
||||
logger.log = logger.info;
|
||||
return logger;
|
||||
}
|
||||
exports.default = createLogger;
|
||||
const logger = (option = {}) => createLogger(option);
|
||||
exports.logger = logger;
|
||||
//# sourceMappingURL=log.js.map
|
||||
1
node_modules/hexo-log/dist/log.js.map
generated
vendored
Normal file
1
node_modules/hexo-log/dist/log.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"log.js","sourceRoot":"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IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,GAAG,IAAiB;QACxB,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC;CACF;AAED,SAAwB,YAAY,CAAC,UAAmB,EAAE;IACxD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;IAEnC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC;IACxB,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC;IACvB,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC;IACvB,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC;IACxB,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC;IAEzB,OAAO,MAAM,CAAC;AAChB,CAAC;AAVD,+BAUC;AAEM,MAAM,MAAM,GAAG,CAAC,SAAkB,EAAE,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;AAAxD,QAAA,MAAM,UAAkD"}
|
||||
54
node_modules/hexo-log/package.json
generated
vendored
Normal file
54
node_modules/hexo-log/package.json
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"name": "hexo-log",
|
||||
"version": "4.1.0",
|
||||
"description": "Logger for Hexo",
|
||||
"main": "dist/log.js",
|
||||
"scripts": {
|
||||
"prepublish ": "npm run clean && npm run build",
|
||||
"build": "tsc -b",
|
||||
"clean": "tsc -b --clean",
|
||||
"eslint": "eslint .",
|
||||
"pretest": "npm run clean && npm run build",
|
||||
"test": "mocha test/index.js --require ts-node/register",
|
||||
"test-cov": "nyc --reporter=lcovonly npm test"
|
||||
},
|
||||
"files": [
|
||||
"dist/**"
|
||||
],
|
||||
"types": "./dist/log.d.ts",
|
||||
"repository": "hexojs/hexo-log",
|
||||
"homepage": "https://hexo.io/",
|
||||
"keywords": [
|
||||
"website",
|
||||
"blog",
|
||||
"cms",
|
||||
"framework",
|
||||
"hexo"
|
||||
],
|
||||
"author": "Tommy Chen <tommy351@gmail.com> (https://zespia.tw)",
|
||||
"maintainers": [
|
||||
"Abner Chou <hi@abnerchou.me> (https://abnerchou.me)"
|
||||
],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.7.18",
|
||||
"@types/rewire": "^2.5.28",
|
||||
"@typescript-eslint/eslint-plugin": "^5.37.0",
|
||||
"@typescript-eslint/parser": "^5.37.0",
|
||||
"chai": "^4.1.2",
|
||||
"eslint": "^8.23.1",
|
||||
"eslint-config-hexo": "^5.0.0",
|
||||
"mocha": "^10.0.0",
|
||||
"nyc": "^15.0.0",
|
||||
"rewire": "^6.0.0",
|
||||
"sinon": "^15.0.2",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^5.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"dependencies": {
|
||||
"picocolors": "^1.0.0"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user