Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add suffix extension types for FileRotationLogger #32

Merged
merged 1 commit into from
Jan 12, 2022

Conversation

sushichop
Copy link
Owner

@sushichop sushichop commented Jan 12, 2022

This PR fixes #12 #27 .

suffixExtension was added to FileRotationLogger.

  • .numbering (default option)

    • foo.log
    • foo.log1
    • foo.log2
  • .date_uuid

    • foo.log
    • foo.log.20211118T1010Z_ecbaf8fe-3807-4056-b6a6-8a6c6b7b2c3e
    • foo.log.20211210T2238Z_7c64672e-8616-48d4-b780-66ca799d407b

Sample code is here.

let fileRotation = try! FileRotationLogger("com.example.yourapp.filerotation",
                                           fileURL: "./logs/foo.log")
fileRotation.suffixExtension = .date_uuid   // Default option is `.numbering`.
fileRotation.maxFileSize = 10 * 1024 * 1024
fileRotation.maxArchivedFilesCount = 2
fileRotation.delegate = delegate
let log = Puppy()
log.add(fileRotation)
log.info("INFO message")
log.warning("WARNING message")

@codecov
Copy link

codecov bot commented Jan 12, 2022

Codecov Report

Merging #32 (40d2a68) into main (2c189c8) will decrease coverage by 3.41%.
The diff coverage is 69.69%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #32      +/-   ##
==========================================
- Coverage   96.55%   93.13%   -3.42%     
==========================================
  Files          11       11              
  Lines         377      408      +31     
==========================================
+ Hits          364      380      +16     
- Misses         13       28      +15     
Impacted Files Coverage Δ
Sources/Puppy/FileRotationLogger.swift 70.83% <69.35%> (-14.54%) ⬇️
Sources/Puppy/FileLogger.swift 92.22% <75.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2c189c8...40d2a68. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider that ideal log rotation file name
1 participant