Skip to content

Commit

Permalink
log rotation to have txt file
Browse files Browse the repository at this point in the history
  • Loading branch information
LePips committed Jan 24, 2022
1 parent b47b027 commit c34356e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Sources/Puppy/FileRotationLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ public class FileRotationLogger: FileLogger {
let oldArchivedFileURLs = ascArchivedFileURLs(fileURL)
for (index, oldArchivedFileURL) in oldArchivedFileURLs.enumerated() {
let generationNumber = oldArchivedFileURLs.count + 1 - index
let rotatedFileURL = oldArchivedFileURL.deletingPathExtension().appendingPathExtension("\(generationNumber)")
let rotatedFileURL = oldArchivedFileURL
.deletingPathExtension()
.appendingPathExtension("\(generationNumber)")
.appendingPathComponent(".txt")
debug("generationNumber: \(generationNumber), rotatedFileURL: \(rotatedFileURL)")
if !FileManager.default.fileExists(atPath: rotatedFileURL.path) {
try FileManager.default.moveItem(at: oldArchivedFileURL, to: rotatedFileURL)
Expand Down

0 comments on commit c34356e

Please sign in to comment.