]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - shared/extra-utils/logs/logs.ts
Add ability for plugins to specify scale filter
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / logs / logs.ts
CommitLineData
fd8710b8
C
1import { makeGetRequest } from '../requests/requests'
2import { LogLevel } from '../../models/server/log-level.type'
2d53be02 3import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
fd8710b8 4
fd8710b8
C
5function getLogs (url: string, accessToken: string, startDate: Date, endDate?: Date, level?: LogLevel) {
6 const path = '/api/v1/server/logs'
7
8 return makeGetRequest({
9 url,
10 path,
11 token: accessToken,
12 query: { startDate, endDate, level },
2d53be02 13 statusCodeExpected: HttpStatusCode.OK_200
fd8710b8
C
14 })
15}
16
566c125d
C
17function getAuditLogs (url: string, accessToken: string, startDate: Date, endDate?: Date) {
18 const path = '/api/v1/server/audit-logs'
19
20 return makeGetRequest({
21 url,
22 path,
23 token: accessToken,
24 query: { startDate, endDate },
2d53be02 25 statusCodeExpected: HttpStatusCode.OK_200
566c125d
C
26 })
27}
28
fd8710b8 29export {
566c125d
C
30 getLogs,
31 getAuditLogs
fd8710b8 32}