|
|
@@ -1,6 +1,7 @@
|
|
|
import type { IUser } from '@growi/core';
|
|
|
import { OptionParser } from '@growi/core/dist/remark-plugins';
|
|
|
import { pathUtils } from '@growi/core/dist/utils';
|
|
|
+import { loggerFactory } from '@growi/logger';
|
|
|
import type { Request, Response } from 'express';
|
|
|
import createError, { isHttpError } from 'http-errors';
|
|
|
|
|
|
@@ -11,6 +12,8 @@ import { addSortCondition } from './add-sort-condition';
|
|
|
import { generateBaseQuery, type PageQuery } from './generate-base-query';
|
|
|
import { getToppageViewersCount } from './get-toppage-viewers-count';
|
|
|
|
|
|
+const logger = loggerFactory('growi:remark-lsx:routes:list-pages');
|
|
|
+
|
|
|
const { addTrailingSlash, removeTrailingSlash } = pathUtils;
|
|
|
|
|
|
/**
|
|
|
@@ -85,8 +88,7 @@ export const listPages = ({
|
|
|
try {
|
|
|
toppageViewersCount = await getToppageViewersCount();
|
|
|
} catch (error) {
|
|
|
- // biome-ignore lint/suspicious/noConsole: Allow to use console.error here
|
|
|
- console.error('Error occurred in getToppageViewersCount:', error);
|
|
|
+ logger.error({ error }, 'Error occurred in getToppageViewersCount');
|
|
|
return res.status(500).send('An internal server error occurred.');
|
|
|
}
|
|
|
|
|
|
@@ -141,10 +143,9 @@ export const listPages = ({
|
|
|
};
|
|
|
return res.status(200).send(responseData);
|
|
|
} catch (error) {
|
|
|
- // biome-ignore lint/suspicious/noConsole: Allow to use console.error here
|
|
|
- console.error(
|
|
|
- 'Error occurred while processing listPages request:',
|
|
|
- error,
|
|
|
+ logger.error(
|
|
|
+ { error },
|
|
|
+ 'Error occurred while processing listPages request',
|
|
|
);
|
|
|
if (isHttpError(error)) {
|
|
|
return res.status(error.status).send(error.message);
|