Skip to content

Commit

Permalink
Merge pull request #4 from Frezyx/dev
Browse files Browse the repository at this point in the history
Release version 0.2.0
  • Loading branch information
Frezyx authored Jan 6, 2022
2 parents 1d90504 + f2885c7 commit b29a6d9
Show file tree
Hide file tree
Showing 57 changed files with 623 additions and 267 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/talker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: talker

on:
push:
paths:
- "talker/**"
- ".github/workflows/talker.yaml"

pull_request:
paths:
- "talker/**"
- ".github/workflows/talker.yaml"

jobs:
build:
defaults:
run:
working-directory: talker

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1

- name: Install Dependencies
run: dart pub get

- name: Format
run: dart format --set-exit-if-changed .

- name: Analyze
run: dart analyze --fatal-infos --fatal-warnings .

- name: Run Tests
run: |
pub global activate test_coverage
export PATH=$PATH:$HOME/.pub-cache/bin
test_coverage
- name: Check Code Coverage
uses: VeryGoodOpenSource/very_good_coverage@v1.2.0
with:
min_coverage: 30
path: talker/coverage/lcov.info
44 changes: 44 additions & 0 deletions .github/workflows/talker_error_hanlder.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: talker_error_handler

on:
push:
paths:
- "talker_error_handler/**"
- ".github/workflows/talker_error_handler.yaml"

pull_request:
paths:
- "talker_error_handler/**"
- ".github/workflows/talker_error_handler.yaml"

jobs:
build:
defaults:
run:
working-directory: talker_error_handler

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1

- name: Install Dependencies
run: dart pub get

- name: Format
run: dart format --set-exit-if-changed .

- name: Analyze
run: dart analyze --fatal-infos --fatal-warnings .

- name: Run Tests
run: |
pub global activate test_coverage
export PATH=$PATH:$HOME/.pub-cache/bin
test_coverage
- name: Check Code Coverage
uses: VeryGoodOpenSource/very_good_coverage@v1.2.0
with:
min_coverage: 30
path: talker_error_handler/coverage/lcov.info
49 changes: 49 additions & 0 deletions .github/workflows/talker_flutter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: talker_flutter

on:
push:
paths:
- "talker_flutter/**"
- ".github/workflows/talker_flutter.yaml"

pull_request:
paths:
- "talker_flutter/**"
- ".github/workflows/talker_flutter.yaml"

jobs:
build:
defaults:
run:
working-directory: talker_flutter

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: "12.x"
- uses: subosito/flutter-action@v1
with:
channel: "stable"

- name: Install Dependencies
run: flutter pub get

- name: Format
run: flutter format --set-exit-if-changed .

- name: Analyze
run: flutter analyze --fatal-infos --fatal-warnings .

- name: Run Tests
run: |
pub global activate test_coverage
export PATH=$PATH:$HOME/.pub-cache/bin
test_coverage
- name: Check Code Coverage
uses: VeryGoodOpenSource/very_good_coverage@v1.2.0
with:
min_coverage: 30
path: talker_flutter/coverage/lcov.info
44 changes: 44 additions & 0 deletions .github/workflows/talker_logger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: talker_logger

on:
push:
paths:
- "talker_logger/**"
- ".github/workflows/talker_logger.yaml"

pull_request:
paths:
- "talker_logger/**"
- ".github/workflows/talker_logger.yaml"

jobs:
build:
defaults:
run:
working-directory: talker_logger

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1

- name: Install Dependencies
run: dart pub get

- name: Format
run: dart format --set-exit-if-changed .

- name: Analyze
run: dart analyze --fatal-infos --fatal-warnings .

- name: Run Tests
run: |
pub global activate test_coverage
export PATH=$PATH:$HOME/.pub-cache/bin
test_coverage
- name: Check Code Coverage
uses: VeryGoodOpenSource/very_good_coverage@v1.2.0
with:
min_coverage: 30
path: talker_logger/coverage/lcov.info
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Talker
Advanced error catching and logging for dart/flutter applications

### 0.1.0
### 0.2.0
Working in progress
6 changes: 5 additions & 1 deletion talker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.0
## 0.2.0
- Simplified package api
- Fix Talker lazy configuration

## 0.1.0

- Initial version.
6 changes: 3 additions & 3 deletions talker/example/talker_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ Future<void> main() async {
try {
throw Exception('Test service exception');
} catch (e, st) {
Talker.instance.handle('Working with string error', e, st);
Talker.instance.handle(e, 'Working with string error', st);
}

try {
throw Exception('Service can`t get test data');
} on Exception catch (e, st) {
Talker.instance.handleException('Working with strings exception', e, st);
Talker.instance.handleException(e, 'Working with strings exception', st);
}

Talker.instance.log(
'Big app crashing exception in Some service',
LogLevel.critical,
logLevel: LogLevel.critical,
additional: {
"timestamp": 1510417124782,
"status": 500,
Expand Down
1 change: 0 additions & 1 deletion talker/lib/src/extensions/log_level.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:talker/talker.dart';
import 'package:talker_error_handler/talker_error_handler.dart';

extension ToLogLevel on ErrorLevel? {
LogLevel get loglevel {
Expand Down
6 changes: 3 additions & 3 deletions talker/lib/src/extensions/talker_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import 'package:talker/src/src.dart';

extension HistoryListText on List<TalkerDataInterface> {
String get text {
var m = '';
final sb = StringBuffer();
for (final data in this) {
m += '${data.generateTextMessage()}\n';
sb.write('${data.generateTextMessage()}\n');
}
return m;
return sb.toString();
}
}
19 changes: 14 additions & 5 deletions talker/lib/src/models/talker_data/talker_data_interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,43 @@ extension GetTitle on TalkerDataInterface {
title = logLevel.title;
break;
}
return '[$title]' + ' | ${DateTimeFormater(time).timeAndSeconds} | ';
return '[$title]' + ' | $displayTime | ';
}

String get consoleStackTrace {
String get displayStackTrace {
if (stackTrace == null) {
return '';
}
return '\nStackTrace:\n${stackTrace ?? ''}';
}

String get consoleException {
String get displayException {
if (exception == null) {
return '';
}
return '\nException: $exception';
}

String get consoleError {
String get displayError {
if (error == null) {
return '';
}
return '\nError: $error';
}

String get consoleAditional {
String get displayAditional {
if (additional == null) {
return '';
}
return '\n$additional';
}

String get displayMessage {
if (message == null) {
return '';
}
return '$message';
}

String get displayTime => TalkerDateTimeFormater(time).timeAndSeconds;
}
14 changes: 6 additions & 8 deletions talker/lib/src/models/talker_data/talker_error.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ import 'package:talker/talker.dart';

class TalkerError implements TalkerDataInterface {
TalkerError(
this.message, {
this.error, {
this.message,
this.logLevel,
this.error,
this.stackTrace,
DateTime? time,
}) {
_time = time ?? DateTime.now();
}

@override
final String message;
final Error error;

@override
final Exception? exception = null;
final String? message;

@override
final Error? error;
final Exception? exception = null;

@override
final StackTrace? stackTrace;
Expand All @@ -31,9 +31,7 @@ class TalkerError implements TalkerDataInterface {

@override
String generateTextMessage() {
final mes = '$titleText$message$consoleError\n$consoleStackTrace';
final underline = ConsoleFormater.getUnderLine(mes);
return mes + underline;
return '$titleText$displayMessage$displayError\n$displayStackTrace';
}

@override
Expand Down
12 changes: 5 additions & 7 deletions talker/lib/src/models/talker_data/talker_exception.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import 'package:talker/talker.dart';

class TalkerException implements TalkerDataInterface {
TalkerException(
this.message, {
this.exception, {
this.message,
this.logLevel,
this.exception,
this.stackTrace,
DateTime? time,
}) {
_time = time ?? DateTime.now();
}

@override
final String message;
final Exception exception;

@override
final Exception? exception;
final String? message;

@override
final Error? error = null;
Expand All @@ -31,9 +31,7 @@ class TalkerException implements TalkerDataInterface {

@override
String generateTextMessage() {
final mes = '$titleText$message$consoleException$consoleStackTrace';
final underline = ConsoleFormater.getUnderLine(mes);
return mes + underline;
return '$titleText$displayMessage$displayException$displayStackTrace';
}

@override
Expand Down
4 changes: 1 addition & 3 deletions talker/lib/src/models/talker_data/talker_log.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ class TalkerLog implements TalkerDataInterface {

@override
String generateTextMessage() {
final mes = '$titleText$message$consoleAditional';
final underline = ConsoleFormater.getUnderLine(mes);
return mes + underline;
return '$titleText$message$displayAditional';
}

@override
Expand Down
2 changes: 1 addition & 1 deletion talker/lib/src/observers/observers_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class TalkerObserversManager {
TalkerObserversManager(this.observers);
final List<TalkerObserver> observers;

void onError(ErrorContainer container) {
void onError(ErrorDetails container) {
for (final o in observers) {
o.onError(container);
}
Expand Down
Loading

0 comments on commit b29a6d9

Please sign in to comment.