-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #132 from mineral-dart/feat-implement-logger-service
feat: implement logger service
- Loading branch information
Showing
5 changed files
with
55 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Console | ||
This directory contains the implementation of the mineral command line interface. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:mineral/services/logger/logger_contract.dart'; | ||
import 'package:tint/tint.dart'; | ||
|
||
class Logger implements LoggerContract { | ||
@override | ||
void debug(String message) => | ||
stdout.writeln('${'[ debug ]'.grey()} $message'); | ||
|
||
@override | ||
void error(String message) => | ||
stdout.writeln('${'[ error ]'.red()} $message'); | ||
|
||
@override | ||
void info(String message) => | ||
stdout.writeln('${'[ info ]'.cyan()} $message'); | ||
|
||
@override | ||
void log(message) => | ||
stdout.writeln('[log] $message'); | ||
|
||
@override | ||
void success(String message) => | ||
stdout.writeln('${'[ success ]'.green()} $message'); | ||
|
||
@override | ||
void warning(String message) => | ||
stdout.writeln('${'[ warning ]'.yellow()} $message'); | ||
} |
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 @@ | ||
abstract interface class LoggerContract { | ||
void log(dynamic message); | ||
|
||
void error(String message); | ||
|
||
void warning(String message); | ||
|
||
void success(String message); | ||
|
||
void info(String message); | ||
|
||
void debug(String message); | ||
} |
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