181
182
private async _rotate(): Promise<void> {
184
>
const oldSegment = this._segment - this._maxFiles;
185
>
if (oldSegment >= 0) {
186
>
await this._fileService.del(this._resourceForSegment(oldSegment)).catch(error => {
187
this._logService.trace('[AHPLog] Failed to delete old transport log', error);
189
>
}
190
>
this._currentFile = this._resourceForSegment(this._segment);
191
>
this._currentSize = await this._getFileSize(this._currentFile);
192
>
}
193
194
private _resourceForSegment(segment: number): URI {
196
>
return joinPath(this._directory, this._baseName);
197
>
}
198
>
const currentBaseName = this._baseName.slice(0, -'.jsonl'.length);
199
>
return joinPath(this._directory, `${currentBaseName}.${segment}.jsonl`);
200
>
}
201
202
private async _getFileSize(resource: URI): Promise<number> {