Nicolas Lopez

LogExtensions

  1 +import 'dart:developer';
  2 +
  3 +import '../../../utils.dart';
1 import '../regex/get_utils.dart'; 4 import '../regex/get_utils.dart';
2 5
3 extension GetDynamicUtils on dynamic { 6 extension GetDynamicUtils on dynamic {
@@ -7,4 +10,10 @@ extension GetDynamicUtils on dynamic { @@ -7,4 +10,10 @@ extension GetDynamicUtils on dynamic {
7 bool get isNull => GetUtils.isNull(this); 10 bool get isNull => GetUtils.isNull(this);
8 11
9 bool get isNullOrBlank => GetUtils.isNullOrBlank(this); 12 bool get isNullOrBlank => GetUtils.isNullOrBlank(this);
  13 +
  14 + void logError({String info = ''}) =>
  15 + GetUtils.log('Error: ${this.runtimeType}', this, info);
  16 +
  17 + void logInfo({String info = ''}) =>
  18 + GetUtils.log('Info: ${this.runtimeType}', this, info);
10 } 19 }
@@ -484,4 +484,7 @@ class GetUtils { @@ -484,4 +484,7 @@ class GetUtils {
484 static bool hasMatch(String value, String pattern) { 484 static bool hasMatch(String value, String pattern) {
485 return (value == null) ? false : RegExp(pattern).hasMatch(value); 485 return (value == null) ? false : RegExp(pattern).hasMatch(value);
486 } 486 }
  487 +
  488 + static void log(String prefix, dynamic value, String info) =>
  489 + print('$prefix $value $info');
487 } 490 }