SimpleNativeLogger class

Main class of this plugin.

Example :

import 'package:simple_native_logger/simple_native_logger.dart';

void main() {
  SimpleNativeLogger.init();
  ...
}
  ...
  final _nativeLogger = SimpleNativeLogger(tag: "MyApp");
  _nativeLogger.w("<log message>");

  try {
    ...
  } catch (ex, stack) {
    _nativeLogger.e(ex, stack: stack);
  }

Following table is list of logging methods and it's corresponding platform methods.

methods android iOS/macos
SimpleNativeLogger.v Log.v Logger.debug
SimpleNativeLogger.d Log.d Logger.debug
SimpleNativeLogger.i Log.i Logger.info
SimpleNativeLogger.w Log.w Logger.notice
SimpleNativeLogger.e Log.e Logger.error
SimpleNativeLogger.f Log.wtf Logger.fault

Constructors

SimpleNativeLogger({String tag = 'flutter', LogLevel logLevel = LogLevel.verbose, int stackCount = 3, bool addLineNumber = true, bool useIsLoggable = false})

Properties

addLineNumber bool
Whether add source filename and line number to log message
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
logLevel LogLevel
Determine which log level to output.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stackCount int
Depth of stack trace to be logged.
getter/setter pair
tag String
Used to categorize log message.
getter/setter pair
useIsLoggable bool
Whether call Log.isLoggable method before logging in Android.
getter/setter pair

Methods

d(Object message, {StackTrace? stack}) → void
Log debug message
e(Object message, {StackTrace? stack}) → void
Log error message
echo(LogInfo info) → void
Internal method used to echo back to console.
f(Object message, {StackTrace? stack}) → void
Log fatal message
i(Object message, {StackTrace? stack}) → void
Log info message
isEchoNeeded(LogLevel logLevel) bool
Internal method used to determine whether echo back needed.
log(LogLevel level, Object message, StackTrace? stack) → void
Low level log method.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
v(Object message, {StackTrace? stack}) → void
Log verbose message
w(Object message, {StackTrace? stack}) → void
Log warning message

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

init() → void
static initialize method.