logger icon indicating copy to clipboard operation
logger copied to clipboard

Allow to change disk log destination

Open renyuneyun opened this issue 7 years ago • 5 comments

  • Add a builder to construct DiskLogStrategy.
  • Move the default construction of DiskLogStrategy from CsvFormatStrategy to DiskLogStrategy.Builder.
  • Allow to customize log destination.

renyuneyun avatar Sep 17 '17 12:09 renyuneyun

@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.

renyuneyun avatar Dec 26 '17 22:12 renyuneyun

I mean the "logger" directory = diskPath + File.separatorChar + "logger";

the "logger" is hardcoded, I suggest to be able to custom that name.

jefryjacky avatar Jan 02 '18 13:01 jefryjacky

@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?

renyuneyun avatar Jan 06 '18 19:01 renyuneyun

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.

orhanobut avatar Apr 01 '18 05:04 orhanobut

I have changed some, but with one thing not sure: How shoud I test the builder? Just confirm the resulting DiskLogStrategy will log?

renyuneyun avatar Apr 29 '18 23:04 renyuneyun