From d14bfa3122c69b434ac2e174bc0025ccaf458340 Mon Sep 17 00:00:00 2001 From: Rene Floor Date: Mon, 29 Nov 2021 19:37:37 +0100 Subject: [PATCH] add documentation --- flutter_cache_manager/CHANGELOG.md | 6 ++++++ flutter_cache_manager/example/lib/main.dart | 1 + flutter_cache_manager/lib/src/logger.dart | 5 +++++ flutter_cache_manager/pubspec.yaml | 2 +- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/flutter_cache_manager/CHANGELOG.md b/flutter_cache_manager/CHANGELOG.md index 327c2047..f6b26e89 100644 --- a/flutter_cache_manager/CHANGELOG.md +++ b/flutter_cache_manager/CHANGELOG.md @@ -1,3 +1,9 @@ +## [3.3.0] - 2021-11-29 +* Added option to manage the log level. Doesn't print failed downloads by default anymore. You can set it like this: +```dart +CacheManager.logLevel = CacheManagerLogLevel.verbose; +``` + ## [3.2.0] - 2021-11-27 * [Bugfix] getSingleFile now downloads a new file before completing as the outdated file might have been deleted. diff --git a/flutter_cache_manager/example/lib/main.dart b/flutter_cache_manager/example/lib/main.dart index 6af27563..e2a655d3 100644 --- a/flutter_cache_manager/example/lib/main.dart +++ b/flutter_cache_manager/example/lib/main.dart @@ -12,6 +12,7 @@ void main() { pubDevURL: 'https://pub.dev/packages/flutter_cache_manager', pages: [CacheManagerPage.createPage()], )); + CacheManager.logLevel = CacheManagerLogLevel.verbose; } const url = 'https://blurha.sh/assets/images/img1.jpg'; diff --git a/flutter_cache_manager/lib/src/logger.dart b/flutter_cache_manager/lib/src/logger.dart index b232cbdc..312b16de 100644 --- a/flutter_cache_manager/lib/src/logger.dart +++ b/flutter_cache_manager/lib/src/logger.dart @@ -1,7 +1,10 @@ import '../flutter_cache_manager.dart'; +/// Instance of the cache manager. Can be set to a custom one if preferred. CacheLogger cacheLogger = CacheLogger(); +/// Log levels of the cache manager. Debug shows failed downloads and verbose +/// also shows successful downloads and cache retrievals. enum CacheManagerLogLevel { none, warning, @@ -9,7 +12,9 @@ enum CacheManagerLogLevel { verbose, } +/// [CacheLogger] which is used by the cache manager to log useful information class CacheLogger { + /// Function to log a message on a certain loglevel void log(String message, CacheManagerLogLevel level) { if (CacheManager.logLevel.index >= level.index) { print(message); diff --git a/flutter_cache_manager/pubspec.yaml b/flutter_cache_manager/pubspec.yaml index 20e0f8d8..0d895bb6 100644 --- a/flutter_cache_manager/pubspec.yaml +++ b/flutter_cache_manager/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_cache_manager description: Generic cache manager for flutter. Saves web files on the storages of the device and saves the cache info using sqflite. -version: 3.2.0 +version: 3.3.0 homepage: https://github.com/Baseflow/flutter_cache_manager/tree/master/flutter_cache_manager environment: