Skip to content

Commit

Permalink
feat(logger): added logger
Browse files Browse the repository at this point in the history
  • Loading branch information
RatakondalaArun committed Jul 8, 2022
1 parent 3a5cbff commit e597498
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions lib/logger.dart
@@ -0,0 +1,33 @@
import 'package:cli_util/cli_logging.dart';

export 'package:cli_util/cli_logging.dart' show Progress;

/// Flutter Launcher Icons Logger
class FLILogger {
late Logger _logger;

/// Returns true if this is a verbose logger
final bool isVerbose;

/// Gives access to internal logger
Logger get rawLogger => _logger;

/// Creates a instance of [FLILogger].
/// In case [isVerbose] is `true`,
/// it logs all the [verbose] logs to console
FLILogger(this.isVerbose) {
final ansi = Ansi(Ansi.terminalSupportsAnsi);
_logger = isVerbose ? Logger.verbose(ansi: ansi) : Logger.standard(ansi: ansi);
}

/// Logs error messages
void error(Object? message) => _logger.stderr('⚠️' + message.toString());

/// prings to console if [isVerbose] is true
void verbose(Object? message) => _logger.trace(message.toString());

void info(Object? message) => _logger.stdout(message.toString());

/// Shows progress in console
Progress progress(String message) => _logger.progress(message);
}

0 comments on commit e597498

Please sign in to comment.