setConfig method

Future<void> setConfig(
  1. {String path,
  2. String fileName,
  3. bool localLog,
  4. bool otherLog,
  5. OtherLogConfig otherLogConfig}
)

Set local log file directory

path: Location that stores the log file fileName: Local log file name localLog: Determine whether storing logs locally or not otherLog: Determine whether taking logs with other methods otherLogConfg: Other logging config for taking logs with other methods

Implementation

Future<void> setConfig({
  String path,
  String fileName,
  bool localLog,
  bool otherLog,
  OtherLogConfig otherLogConfig,
}) async {
  /// Set local log folder path
  if (path != null) {
    String finalPath = path;
    bool pathValid = await ckPathExists(path);

    if (!pathValid) {
      finalPath = await createFolder(path);
    }

    _path = finalPath;
  }

  /// Set local log file name
  if (fileName != null) {
    _logFileName = fileName;
  }

  /// Set weather saving local log
  if (localLog != null) {
    _localLog = localLog;
  }

  /// Set weather taking logs with other method
  if (otherLog != null) {
    _otherLog = otherLog;
  }

  /// Set Other log configs
  if (otherLogConfig != null) {
    _otherLogConfig = otherLogConfig;
    if (_otherLogConfig.initRequired && _otherLog) _otherLogConfig.initFnc();
  }

  return;
}