logger
logger copied to clipboard
Allow to change disk log destination
- Add a builder to construct
DiskLogStrategy
. - Move the default construction of
DiskLogStrategy
fromCsvFormatStrategy
toDiskLogStrategy.Builder
. - Allow to customize log destination.
@jefryjacky I don't quite understand your words... What's the difference between "folder" and "directory" (except they are usually used by windows and unix respectively)?
You could pass a directory name like /sdcard/MY/AWESOME/DIRECTORY
to the method and that won't run into a problem.
I mean the "logger" directory = diskPath + File.separatorChar + "logger";
the "logger" is hardcoded, I suggest to be able to custom that name.
@jefryjacky
I think you have misunderstood the meaning. The hardcoded "logger" string is only used in if (directory == null)
which means the user (of the library) doesn't provide a customized directory to use.
If changing the subdirectory instead of "logger" is the only thing the coder wants to do, why doesn't him/her pass Environment.getExternalStorageDirectory().getAbsolutePath() + File.separatorChar + "THE_DIRECTORY"
to the builder?
Sorry for the late response and thanks for the pull request. I wasn't able to review anything this time period. Apart from a few things, all looks good to me. Would you mind to make the following changes? Then we can merge and release a version for this.
- Missing tests, that'd be great if you add some tests
- Support annotation for nullability. Recently I merged a PR which introduced these annotations, which makes easier for kotlin.
- JavaDoc to cover public API. That helps a lot, especially for generic parameters such as path etc.
- Update README.md to reflect these changes.
I have changed some, but with one thing not sure:
How shoud I test the builder? Just confirm the resulting DiskLogStrategy
will log?