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:
Alexandr Garbuzov
2025-10-15 23:03:48 +03:00
committed by GitHub
co-authored by Copilot Alexandr
parent bf021b0670
commit 6d1a5e51bc
9 changed files with 26 additions and 13 deletions
-1
View File
@@ -14,7 +14,6 @@ export {
parseArray,
clampValue,
flexLayout,
logger,
measureText,
lowercaseTrim,
chunkArray,
+14
View File
@@ -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 -1
View File
@@ -1,7 +1,7 @@
// @ts-check
import { CustomError } from "./error.js";
import { logger } from "./utils.js";
import { logger } from "./log.js";
// Script variables.
-6
View File
@@ -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,
+1 -1
View File
@@ -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 -1
View File
@@ -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";