getFileName method

String getFileName()

Implementation

String getFileName() {
  var file = File('$location/$_fileId.log');
  if (file.existsSync()) {
    var size = BinarySize()..bytesCount = file.lengthSync();
    if (DateTime.tryParse(_fileId) != null &&
        DateTime.parse(_fileId)
            .add(Duration(hours: _hours))
            .isAfter(DateTime.now()) &&
        size < singleFileSizeLimit) {
      return "$_fileId.log";
    }
  }
  clearCache();
  _fileId = _format.format(DateTime.now());
  return "$_fileId.log";
}