Skip to content

Commit

Permalink
add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
renefloor committed Nov 29, 2021
1 parent 101cbde commit d14bfa3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions flutter_cache_manager/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
1 change: 1 addition & 0 deletions flutter_cache_manager/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
5 changes: 5 additions & 0 deletions flutter_cache_manager/lib/src/logger.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
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,
debug,
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);
Expand Down
2 changes: 1 addition & 1 deletion flutter_cache_manager/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit d14bfa3

Please sign in to comment.