fix(terminal): показывать последние записи журнала RouterOS
This commit is contained in:
1 parent
1e4d3b4678
commit
bd023b8aaa
15 files changed
+321
-16
No files matched your search
@@ -696,7 +696,13 @@ export class MikrotikClient {
|
||||
}
|
||||
|
||||
async getLogs(limit = 50): Promise<RosLogEntry[]> {
|
||||
return this.get<RosLogEntry[]>(`/log?limit=${limit}`)
|
||||
if (!Number.isSafeInteger(limit) || limit < 1) {
|
||||
throw new RangeError("limit должен быть положительным целым числом.")
|
||||
}
|
||||
// REST query parameters filter properties; limit is not a print row limit.
|
||||
// Read only the default buffer and retain its latest entries in native order.
|
||||
const entries = await this.get<RosLogEntry[]>("/log?buffer=memory&.proplist=.id,time,topics,message")
|
||||
return entries.slice(-Math.min(limit, 200))
|
||||
}
|
||||
|
||||
async ping(
|
||||
|
||||
Reference in new issue
Block a user