You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/index.js
+14-14Lines changed: 14 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -400,21 +400,21 @@ class ErrsolePostgres extends EventEmitter {
400
400
* @returns {Promise<{items: Log[], filters: LogFilter[]}>} - A promise that resolves with an object containing an array of log items and the applied filters.
401
401
* @throws {Error} - Throws an error if the operation fails.
402
402
*/
403
-
asyncsearchLogs(searchTerms,filters={}){
403
+
asyncsearchLogs(searchTerms=[],filters={}){
404
404
constDEFAULT_LOGS_LIMIT=100;
405
405
filters.limit=filters.limit||DEFAULT_LOGS_LIMIT;
406
406
407
407
constwhereClauses=[];
408
408
constvalues=[];
409
409
letorderBy='id DESC';
410
410
letshouldReverse=true;
411
-
letindex=1;
412
411
413
-
// Search terms with AND logic
414
-
if(searchTerms&&searchTerms.length>0){
415
-
consttsQuery=searchTerms.map(term=>`${term}:*`).join(' & ');// AND logic for search terms
constwhereClause=whereClauses.length ? `WHERE ${whereClauses.join(' AND ')}` : '';
482
-
constquery=`SELECT id, hostname, pid, source, timestamp, level, message,errsole_id FROM ${this.logsTable}${whereClause} ORDER BY ${orderBy} LIMIT $${index}`;
482
+
constquery=`SELECT id, hostname, pid, source, timestamp, level, message,errsole_id FROM ${this.logsTable}${whereClause} ORDER BY ${orderBy} LIMIT $${values.length+1}`;
0 commit comments