setUp static method

void setUp({
  1. FlogFormats? formats,
  2. AllowLog? allowLog,
  3. FlogLabeler? label,
  4. bool ansiColorDisabled = false,
  5. bool useCleanStackTrace = true,
})

Formats

.formats

The ability to customize the look of the printed statement.

Customizable:

  • Text:

    • Color
    • Boldness
  • Background:

    • Color

Label

.label

Customizes prefix of printed logs

limit the amount of logic, may slow performance!

Values returned

String Function(DateTime date, String tag, String? feature)

  • date = Time stamp of log
  • tag = The type of log
  • feature = The feature filter
    • if null, or N/A, returns null

Allow Log

.allowLog

Method that is checked, before every log to, to see if logging is enabled

By default, this will log in Debug and Profile modes, and not in Release mod

default:

.allowLog = () {
  if (kDebugMode) return true;
  if (kProfileMode) return true;
  if (kReleaseMode) return false;
  return false;
};

Clean Stack Trace

.useCleanStackTrace

Cleans provided Stack Trace for flogFatal and flogError

reference https://pub.dev/packages/stack_trace for more info

Implementation

static void setUp({
  FlogFormats? formats,
  AllowLog? allowLog,
  FlogLabeler? label,
  bool ansiColorDisabled: false,
  bool useCleanStackTrace: true,
}) {
  c.ansiColorDisabled = ansiColorDisabled;
  _formats = formats;
  _labeler = label;
  _useCleanStackTrace = useCleanStackTrace;
  if (allowLog != null) _allowLog = allowLog;
}