This commit is contained in:
张成
2026-03-18 18:07:41 +08:00
parent 18aa083c91
commit aecb7944a8
8 changed files with 44 additions and 57 deletions

View File

@@ -58,7 +58,9 @@ export function get_app_config() {
chrome_executable_path: (get_env('CHROME_EXECUTABLE_PATH') || '').trim() || path.resolve(__dirname, '../../chrome-win/chrome.exe'),
log_invoke_action: get_bool('LOG_INVOKE_ACTION', true),
auto_close_browser: get_bool('AUTO_CLOSE_BROWSER', true),
enable_stealth: get_bool('ENABLE_STEALTH', true)
enable_stealth: get_bool('ENABLE_STEALTH', true),
log_sql: get_bool('LOG_SQL', false),
log_sql_benchmark: get_bool('LOG_SQL_BENCHMARK', false)
}
};

View File

@@ -10,7 +10,18 @@ export function get_sequelize_options() {
password: cfg.mysql.password,
database: cfg.mysql.database,
dialect: 'mysql',
logging: false,
benchmark: cfg.crawler.log_sql_benchmark === true,
logging: cfg.crawler.log_sql === true
? (sql, timing_ms) => {
if (cfg.crawler.log_sql_benchmark === true && typeof timing_ms === 'number') {
// eslint-disable-next-line no-console
console.log('[sql]', { timing_ms, sql });
return;
}
// eslint-disable-next-line no-console
console.log('[sql]', sql);
}
: false,
define: {
underscored: true,
timestamps: true,