初始化提交
This commit is contained in:
Executable
+13
@@ -0,0 +1,13 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:kaer_with_panels/features/log/model/log_level.dart';
|
||||
|
||||
part 'log_entity.freezed.dart';
|
||||
|
||||
@freezed
|
||||
class LogEntity with _$LogEntity {
|
||||
const factory LogEntity({
|
||||
LogLevel? level,
|
||||
DateTime? time,
|
||||
required String message,
|
||||
}) = _LogEntity;
|
||||
}
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
// import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
// // import 'package:kaer_with_panels/core/localization/translations.dart';
|
||||
// import 'package:kaer_with_panels/core/model/failures.dart';
|
||||
|
||||
// part 'log_failure.freezed.dart';
|
||||
|
||||
// @freezed
|
||||
// sealed class LogFailure with _$LogFailure, Failure {
|
||||
// const LogFailure._();
|
||||
|
||||
// @With<UnexpectedFailure>()
|
||||
// const factory LogFailure.unexpected([
|
||||
// Object? error,
|
||||
// StackTrace? stackTrace,
|
||||
// ]) = LogUnexpectedFailure;
|
||||
|
||||
// @override
|
||||
// ({String type, String? message}) present(TranslationsEn t) {
|
||||
// return switch (this) {
|
||||
// LogUnexpectedFailure() => (
|
||||
// type: t.failure.unexpected,
|
||||
// message: null,
|
||||
// ),
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
import 'package:dart_mappable/dart_mappable.dart';
|
||||
import 'package:dartx/dartx.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
part 'log_level.mapper.dart';
|
||||
|
||||
@MappableEnum()
|
||||
enum LogLevel {
|
||||
trace,
|
||||
debug,
|
||||
info,
|
||||
warn,
|
||||
error,
|
||||
fatal,
|
||||
panic;
|
||||
|
||||
/// [LogLevel] selectable by user as preference
|
||||
static List<LogLevel> get choices => values.takeFirst(4);
|
||||
|
||||
Color? get color => switch (this) {
|
||||
trace => Colors.lightBlueAccent,
|
||||
debug => Colors.grey,
|
||||
info => Colors.lightGreen,
|
||||
warn => Colors.orange,
|
||||
error => Colors.redAccent,
|
||||
fatal => Colors.red,
|
||||
panic => Colors.red,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user