forked from mirrored/github-readme-stats
refactor: move logger into separate module (#4581)
* refactor: move logger into separate module * Update api/status/pat-info.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Alexandr <qwerty541zxc@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
co-authored by
Copilot
Alexandr
parent
bf021b0670
commit
6d1a5e51bc
@@ -14,7 +14,6 @@ export {
|
||||
parseArray,
|
||||
clampValue,
|
||||
flexLayout,
|
||||
logger,
|
||||
measureText,
|
||||
lowercaseTrim,
|
||||
chunkArray,
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// @ts-check
|
||||
|
||||
const noop = () => {};
|
||||
|
||||
/**
|
||||
* Return console instance based on the environment.
|
||||
*
|
||||
* @type {Console | {log: () => void, error: () => void}}
|
||||
*/
|
||||
const logger =
|
||||
process.env.NODE_ENV === "test" ? { log: noop, error: noop } : console;
|
||||
|
||||
export { logger };
|
||||
export default logger;
|
||||
@@ -1,7 +1,7 @@
|
||||
// @ts-check
|
||||
|
||||
import { CustomError } from "./error.js";
|
||||
import { logger } from "./utils.js";
|
||||
import { logger } from "./log.js";
|
||||
|
||||
// Script variables.
|
||||
|
||||
|
||||
@@ -211,11 +211,6 @@ const renderError = ({
|
||||
`;
|
||||
};
|
||||
|
||||
const noop = () => {};
|
||||
// return console instance based on the environment
|
||||
const logger =
|
||||
process.env.NODE_ENV === "test" ? { log: noop, error: noop } : console;
|
||||
|
||||
/**
|
||||
* Retrieve text length.
|
||||
*
|
||||
@@ -329,7 +324,6 @@ export {
|
||||
parseArray,
|
||||
clampValue,
|
||||
flexLayout,
|
||||
logger,
|
||||
measureText,
|
||||
lowercaseTrim,
|
||||
chunkArray,
|
||||
|
||||
@@ -5,7 +5,7 @@ import * as dotenv from "dotenv";
|
||||
import githubUsernameRegex from "github-username-regex";
|
||||
import { calculateRank } from "../calculateRank.js";
|
||||
import { retryer } from "../common/retryer.js";
|
||||
import { logger } from "../common/utils.js";
|
||||
import { logger } from "../common/log.js";
|
||||
import { excludeRepositories } from "../common/envs.js";
|
||||
import { CustomError, MissingParamError } from "../common/error.js";
|
||||
import { wrapTextMultiline } from "../common/fmt.js";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// @ts-check
|
||||
|
||||
import { retryer } from "../common/retryer.js";
|
||||
import { logger } from "../common/utils.js";
|
||||
import { logger } from "../common/log.js";
|
||||
import { excludeRepositories } from "../common/envs.js";
|
||||
import { CustomError, MissingParamError } from "../common/error.js";
|
||||
import { wrapTextMultiline } from "../common/fmt.js";
|
||||
|
||||
Reference in New Issue
Block a user