Skip to content

Commit

Permalink
Fix message to string converting
Browse files Browse the repository at this point in the history
  • Loading branch information
vaetas committed Jul 30, 2020
1 parent 5fc2aca commit 7e1e366
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [0.0.4] - 2020-07-30

* Convert message to string.

## [0.0.3] - 2020-07-29

* Add screenshot to README.
Expand Down
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ExampleApp extends StatelessWidget with LogMixin {
children: <Widget>[
RaisedButton(
onPressed: () {
log.t('Hello world');
log('Hello world');
},
child: Text('Log!'),
),
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.1"
version: "0.0.4"
matcher:
dependency: transitive
description:
Expand Down
27 changes: 16 additions & 11 deletions lib/src/log.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'dart:developer' as dev;
const _kLogName = 'log';

void _logTime(
dynamic message, {
Object message, {
String name,
Object error,
StackTrace stackTrace,
Expand All @@ -21,13 +21,13 @@ void _logTime(
class Log {
/// Simple debug log.
static void d(
dynamic message, {
Object message, {
String name,
Object error,
StackTrace stackTrace,
}) {
dev.log(
message,
'$message',
name: _formatName(name ?? _kLogName),
error: error,
stackTrace: stackTrace,
Expand All @@ -36,13 +36,13 @@ class Log {

/// Debug print which adds timestamp to log.
static void t(
dynamic message, {
Object message, {
String name,
Object error,
StackTrace stackTrace,
}) {
_logTime(
message,
'$message',
name: _formatName(name ?? _kLogName),
error: error,
stackTrace: stackTrace,
Expand All @@ -61,23 +61,28 @@ class LogX {

/// Instance of [LogX] is callable.
void call(
dynamic message, {
Object message, {
String name,
Object error,
StackTrace stackTrace,
}) {
this.d(message);
this.d(
'$message',
name: name,
error: error,
stackTrace: stackTrace,
);
}

/// Simple debug output. When using mixin [name] is deduced from current class.
void d(
dynamic message, {
Object message, {
String name,
Object error,
StackTrace stackTrace,
}) {
dev.log(
message,
'$message',
name: _formatName(name ?? (this.name ?? _kLogName)),
error: error,
stackTrace: stackTrace,
Expand All @@ -86,13 +91,13 @@ class LogX {

/// Debug print which adds timestamp to log.
void t(
dynamic message, {
Object message, {
String name,
Object error,
StackTrace stackTrace,
}) {
_logTime(
message,
'$message',
name: _formatName(name ?? (this.name ?? _kLogName)),
error: error,
stackTrace: stackTrace,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: logx
description: Simple and concise logs for Dart/Flutter built on top of developer package.
version: 0.0.3
version: 0.0.4
homepage: https://github.com/vaetas/logx

environment:
Expand Down

0 comments on commit 7e1e366

Please sign in to comment.