forked from openfoodfacts/smooth-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Logs service (+ email attachment) (openfoodfacts#2303)
* Logs service (+ email attachment) * Fix flutter format warning * Reformat code * Remove fimber_io dependency to have our own implementations instead * Add close:true to email dialog * Add SENDTO query to AndroidManifest * Remove useless comment
- Loading branch information
Showing
23 changed files
with
580 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
packages/smooth_app/lib/services/logs/fimber/fimber_helper.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import 'package:smooth_app/services/logs/smooth_log_levels.dart'; | ||
|
||
extension LogLevelExtension on LogLevel { | ||
String get fimberLevel { | ||
switch (this) { | ||
case LogLevel.verbose: | ||
return 'V'; | ||
case LogLevel.debug: | ||
return 'D'; | ||
case LogLevel.info: | ||
return 'I'; | ||
case LogLevel.warning: | ||
return 'W'; | ||
case LogLevel.error: | ||
return 'E'; | ||
} | ||
} | ||
} | ||
|
||
extension LogLevelsExtension on Iterable<LogLevel> { | ||
List<String> get fimberLevels => | ||
map((LogLevel level) => level.fimberLevel).toList(growable: false); | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/smooth_app/lib/services/logs/fimber/trees/base_fimber_tree.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import 'package:fimber/fimber.dart'; | ||
import 'package:smooth_app/services/logs/fimber/fimber_helper.dart'; | ||
import 'package:smooth_app/services/logs/smooth_log_levels.dart'; | ||
|
||
abstract class BaseFimberTree extends LogTree { | ||
BaseFimberTree({required List<LogLevel> logLevels}) | ||
: assert(logLevels.isNotEmpty), | ||
_logLevels = logLevels | ||
.map((LogLevel level) => level.fimberLevel) | ||
.toList(growable: false), | ||
super(); | ||
|
||
final List<String> _logLevels; | ||
|
||
@override | ||
List<String> getLevels() => _logLevels; | ||
} |
13 changes: 13 additions & 0 deletions
13
packages/smooth_app/lib/services/logs/fimber/trees/debug_fimber_tree.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import 'package:fimber/fimber.dart'; | ||
import 'package:smooth_app/services/logs/fimber/fimber_helper.dart'; | ||
import 'package:smooth_app/services/logs/smooth_log_levels.dart'; | ||
|
||
class DebugFimberTree extends DebugTree { | ||
DebugFimberTree({required List<LogLevel> logLevels}) | ||
: assert(logLevels.isNotEmpty), | ||
super( | ||
logLevels: logLevels | ||
.map((LogLevel level) => level.fimberLevel) | ||
.toList(growable: false), | ||
); | ||
} |
Oops, something went wrong.