mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-24 18:38:48 +01:00
Clean up logs
This commit is contained in:
parent
f4ade24950
commit
63772e6e17
15 changed files with 42 additions and 30 deletions
|
@ -73,7 +73,7 @@ class AppPasswordExchangeBloc
|
||||||
final appPwd = await api_util.exchangePassword(account);
|
final appPwd = await api_util.exchangePassword(account);
|
||||||
yield AppPasswordExchangeBlocSuccess(appPwd);
|
yield AppPasswordExchangeBlocSuccess(appPwd);
|
||||||
} catch (e, stacktrace) {
|
} catch (e, stacktrace) {
|
||||||
_log.severe("[_exchangePassword] Failed while exchanging password", e,
|
_log.shout("[_exchangePassword] Failed while exchanging password", e,
|
||||||
stacktrace);
|
stacktrace);
|
||||||
yield AppPasswordExchangeBlocFailure(e);
|
yield AppPasswordExchangeBlocFailure(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ abstract class AlbumItem {
|
||||||
case AlbumFileItem._type:
|
case AlbumFileItem._type:
|
||||||
return AlbumFileItem.fromJson(content.cast<String, dynamic>());
|
return AlbumFileItem.fromJson(content.cast<String, dynamic>());
|
||||||
default:
|
default:
|
||||||
_log.severe("[fromJson] Unknown type: $type");
|
_log.shout("[fromJson] Unknown type: $type");
|
||||||
throw ArgumentError.value(type, "type");
|
throw ArgumentError.value(type, "type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -406,11 +406,10 @@ class AlbumCachedDataSource implements AlbumDataSource {
|
||||||
}
|
}
|
||||||
_log.info(
|
_log.info(
|
||||||
"[get] Remote content updated for ${AppDbAlbumEntry.toPath(account, albumFile)}");
|
"[get] Remote content updated for ${AppDbAlbumEntry.toPath(account, albumFile)}");
|
||||||
|
} on CacheNotFoundException catch (_) {
|
||||||
|
// normal when there's no cache
|
||||||
} catch (e, stacktrace) {
|
} catch (e, stacktrace) {
|
||||||
// no cache
|
_log.shout("[get] Cache failure", e, stacktrace);
|
||||||
if (e is! CacheNotFoundException) {
|
|
||||||
_log.severe("[get] Cache failure", e, stacktrace);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// no cache
|
// no cache
|
||||||
|
|
|
@ -623,11 +623,10 @@ class FileCachedDataSource implements FileDataSource {
|
||||||
}
|
}
|
||||||
_log.info(
|
_log.info(
|
||||||
"[list] Remote content updated for ${AppDbFileEntry.toPath(account, f)}");
|
"[list] Remote content updated for ${AppDbFileEntry.toPath(account, f)}");
|
||||||
|
} on CacheNotFoundException catch (_) {
|
||||||
|
// normal when there's no cache
|
||||||
} catch (e, stacktrace) {
|
} catch (e, stacktrace) {
|
||||||
// no cache
|
_log.shout("[list] Cache failure", e, stacktrace);
|
||||||
if (e is! CacheNotFoundException) {
|
|
||||||
_log.severe("[list] Cache failure", e, stacktrace);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// no cache
|
// no cache
|
||||||
|
@ -638,7 +637,7 @@ class FileCachedDataSource implements FileDataSource {
|
||||||
try {
|
try {
|
||||||
await _cleanUpCachedDir(account, remote, cache);
|
await _cleanUpCachedDir(account, remote, cache);
|
||||||
} catch (e, stacktrace) {
|
} catch (e, stacktrace) {
|
||||||
_log.severe("[list] Failed while _cleanUpCachedList", e, stacktrace);
|
_log.shout("[list] Failed while _cleanUpCachedList", e, stacktrace);
|
||||||
// ignore error
|
// ignore error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ class WebdavFileParser {
|
||||||
element.matchQualifiedName("multistatus",
|
element.matchQualifiedName("multistatus",
|
||||||
prefix: "DAV:", namespaces: _namespaces));
|
prefix: "DAV:", namespaces: _namespaces));
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
_log.severe("[call] Missing element: multistatus");
|
_log.shout("[call] Missing element: multistatus");
|
||||||
rethrow;
|
rethrow;
|
||||||
}
|
}
|
||||||
}();
|
}();
|
||||||
|
@ -27,7 +27,7 @@ class WebdavFileParser {
|
||||||
try {
|
try {
|
||||||
return _toFile(element);
|
return _toFile(element);
|
||||||
} catch (e, stacktrace) {
|
} catch (e, stacktrace) {
|
||||||
_log.severe("[call] Failed parsing XML", e, stacktrace);
|
_log.shout("[call] Failed parsing XML", e, stacktrace);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -36,7 +36,7 @@ class MetadataLoader implements itf.MetadataLoader {
|
||||||
final response =
|
final response =
|
||||||
await Api(account).files().get(path: api_util.getFileUrlRelative(file));
|
await Api(account).files().get(path: api_util.getFileUrlRelative(file));
|
||||||
if (!response.isGood) {
|
if (!response.isGood) {
|
||||||
_log.severe("[forceLoadFile] Failed requesting server: $response");
|
_log.severe("[loadNewFile] Failed requesting server: $response");
|
||||||
throw ApiException(
|
throw ApiException(
|
||||||
response: response,
|
response: response,
|
||||||
message: "Failed communicating with server: ${response.statusCode}");
|
message: "Failed communicating with server: ${response.statusCode}");
|
||||||
|
|
|
@ -25,7 +25,7 @@ class ListAlbum {
|
||||||
albumRepo.cleanUp(account, albumFiles);
|
albumRepo.cleanUp(account, albumFiles);
|
||||||
} catch (e, stacktrace) {
|
} catch (e, stacktrace) {
|
||||||
// not important, log and ignore
|
// not important, log and ignore
|
||||||
_log.severe("[call] Failed while cleanUp", e, stacktrace);
|
_log.shout("[call] Failed while cleanUp", e, stacktrace);
|
||||||
}
|
}
|
||||||
return albums;
|
return albums;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Remove {
|
||||||
await UpdateAlbum(albumRepo)(account, a.copyWith(items: newItems));
|
await UpdateAlbum(albumRepo)(account, a.copyWith(items: newItems));
|
||||||
}
|
}
|
||||||
} catch (e, stacktrace) {
|
} catch (e, stacktrace) {
|
||||||
_log.severe(
|
_log.shout(
|
||||||
"[_cleanUpAlbums] Failed while updating album", e, stacktrace);
|
"[_cleanUpAlbums] Failed while updating album", e, stacktrace);
|
||||||
// continue to next album
|
// continue to next album
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:nc_photos/account.dart';
|
import 'package:nc_photos/account.dart';
|
||||||
import 'package:nc_photos/entity/file.dart';
|
import 'package:nc_photos/entity/file.dart';
|
||||||
|
@ -22,7 +23,11 @@ class ScanDir {
|
||||||
yield* this(account, i);
|
yield* this(account, i);
|
||||||
}
|
}
|
||||||
} catch (e, stacktrace) {
|
} catch (e, stacktrace) {
|
||||||
_log.severe("[call] Failed scanning \"${root.path}\"", e, stacktrace);
|
_log.shout(
|
||||||
|
"[call] Failed while listing dir" +
|
||||||
|
(kDebugMode ? ": ${root.path}" : ""),
|
||||||
|
e,
|
||||||
|
stacktrace);
|
||||||
// for some reason exception thrown here can't be caught outside
|
// for some reason exception thrown here can't be caught outside
|
||||||
// rethrow;
|
// rethrow;
|
||||||
yield e;
|
yield e;
|
||||||
|
|
|
@ -42,7 +42,7 @@ class UpdateMetadata {
|
||||||
await UpdateAlbum(albumRepo)(account, a.copyWith(items: newItems));
|
await UpdateAlbum(albumRepo)(account, a.copyWith(items: newItems));
|
||||||
}
|
}
|
||||||
} catch (e, stacktrace) {
|
} catch (e, stacktrace) {
|
||||||
_log.severe(
|
_log.shout(
|
||||||
"[_cleanUpAlbums] Failed while updating album", e, stacktrace);
|
"[_cleanUpAlbums] Failed while updating album", e, stacktrace);
|
||||||
// continue to next album
|
// continue to next album
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ class UpdateMissingMetadata {
|
||||||
AlbumRepo(AlbumCachedDataSource()))(account, file, metadataObj);
|
AlbumRepo(AlbumCachedDataSource()))(account, file, metadataObj);
|
||||||
yield file;
|
yield file;
|
||||||
} catch (e, stacktrace) {
|
} catch (e, stacktrace) {
|
||||||
_log.severe("[call] Failed while getting metadata", e, stacktrace);
|
_log.shout("[call] Failed while getting metadata", e, stacktrace);
|
||||||
yield e;
|
yield e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,7 +238,7 @@ class _AlbumViewerState extends State<AlbumViewer>
|
||||||
_transformItems();
|
_transformItems();
|
||||||
});
|
});
|
||||||
}).catchError((e, stacktrace) {
|
}).catchError((e, stacktrace) {
|
||||||
_log.severe("[_onSelectionRemovePressed] Failed while updating album", e,
|
_log.shout("[_onSelectionRemovePressed] Failed while updating album", e,
|
||||||
stacktrace);
|
stacktrace);
|
||||||
SnackBarManager().showSnackBar(SnackBar(
|
SnackBarManager().showSnackBar(SnackBar(
|
||||||
content: Text(
|
content: Text(
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
@ -335,8 +336,9 @@ class _HomeAlbumsState extends State<HomeAlbums> {
|
||||||
try {
|
try {
|
||||||
await Remove(fileRepo, albumRepo)(widget.account, f);
|
await Remove(fileRepo, albumRepo)(widget.account, f);
|
||||||
} catch (e, stacktrace) {
|
} catch (e, stacktrace) {
|
||||||
_log.severe(
|
_log.shout(
|
||||||
"[_onSelectionAppBarDeletePressed] Failed while removing file: ${f.path}",
|
"[_onSelectionAppBarDeletePressed] Failed while removing file" +
|
||||||
|
(kDebugMode ? ": ${f.path}" : ""),
|
||||||
e,
|
e,
|
||||||
stacktrace);
|
stacktrace);
|
||||||
failures.add(f);
|
failures.add(f);
|
||||||
|
|
|
@ -267,7 +267,7 @@ class _HomePhotosState extends State<HomePhotos>
|
||||||
]),
|
]),
|
||||||
));
|
));
|
||||||
} catch (e, stacktrace) {
|
} catch (e, stacktrace) {
|
||||||
_log.severe(
|
_log.shout(
|
||||||
"[_addSelectedToAlbum] Failed while updating album", e, stacktrace);
|
"[_addSelectedToAlbum] Failed while updating album", e, stacktrace);
|
||||||
SnackBarManager().showSnackBar(SnackBar(
|
SnackBarManager().showSnackBar(SnackBar(
|
||||||
content: Text(
|
content: Text(
|
||||||
|
@ -299,8 +299,9 @@ class _HomePhotosState extends State<HomePhotos>
|
||||||
try {
|
try {
|
||||||
await Remove(fileRepo, albumRepo)(widget.account, f);
|
await Remove(fileRepo, albumRepo)(widget.account, f);
|
||||||
} catch (e, stacktrace) {
|
} catch (e, stacktrace) {
|
||||||
_log.severe(
|
_log.shout(
|
||||||
"[_onSelectionAppBarDeletePressed] Failed while removing file: ${f.path}",
|
"[_onSelectionAppBarDeletePressed] Failed while removing file" +
|
||||||
|
(kDebugMode ? ": ${f.path}" : ""),
|
||||||
e,
|
e,
|
||||||
stacktrace);
|
stacktrace);
|
||||||
failures.add(f);
|
failures.add(f);
|
||||||
|
|
|
@ -576,7 +576,7 @@ class _ViewerState extends State<Viewer> with TickerProviderStateMixin {
|
||||||
duration: k.snackBarDurationNormal,
|
duration: k.snackBarDurationNormal,
|
||||||
));
|
));
|
||||||
} catch (e, stacktrace) {
|
} catch (e, stacktrace) {
|
||||||
_log.severe(
|
_log.shout(
|
||||||
"[_onDownloadPressed] Failed while downloadFile", e, stacktrace);
|
"[_onDownloadPressed] Failed while downloadFile", e, stacktrace);
|
||||||
controller?.close();
|
controller?.close();
|
||||||
SnackBarManager().showSnackBar(SnackBar(
|
SnackBarManager().showSnackBar(SnackBar(
|
||||||
|
@ -608,7 +608,10 @@ class _ViewerState extends State<Viewer> with TickerProviderStateMixin {
|
||||||
));
|
));
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
} catch (e, stacktrace) {
|
} catch (e, stacktrace) {
|
||||||
_log.severe("[_onDeletePressed] Failed while remove: ${file.path}", e,
|
_log.shout(
|
||||||
|
"[_onDeletePressed] Failed while remove" +
|
||||||
|
(kDebugMode ? ": ${file.path}" : ""),
|
||||||
|
e,
|
||||||
stacktrace);
|
stacktrace);
|
||||||
controller?.close();
|
controller?.close();
|
||||||
SnackBarManager().showSnackBar(SnackBar(
|
SnackBarManager().showSnackBar(SnackBar(
|
||||||
|
|
|
@ -226,8 +226,11 @@ class _ViewerDetailPaneState extends State<ViewerDetailPane> {
|
||||||
));
|
));
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
} catch (e, stacktrace) {
|
} catch (e, stacktrace) {
|
||||||
_log.severe("[_onDeletePressed] Failed while remove: ${widget.file.path}",
|
_log.shout(
|
||||||
e, stacktrace);
|
"[_onDeletePressed] Failed while remove" +
|
||||||
|
(kDebugMode ? ": ${widget.file.path}" : ""),
|
||||||
|
e,
|
||||||
|
stacktrace);
|
||||||
controller?.close();
|
controller?.close();
|
||||||
SnackBarManager().showSnackBar(SnackBar(
|
SnackBarManager().showSnackBar(SnackBar(
|
||||||
content:
|
content:
|
||||||
|
@ -344,7 +347,7 @@ class _ViewerDetailPaneState extends State<ViewerDetailPane> {
|
||||||
items: [...album.items, AlbumFileItem(file: widget.file)],
|
items: [...album.items, AlbumFileItem(file: widget.file)],
|
||||||
));
|
));
|
||||||
} catch (e, stacktrace) {
|
} catch (e, stacktrace) {
|
||||||
_log.severe("[_addToAlbum] Failed while updating album", e, stacktrace);
|
_log.shout("[_addToAlbum] Failed while updating album", e, stacktrace);
|
||||||
SnackBarManager().showSnackBar(SnackBar(
|
SnackBarManager().showSnackBar(SnackBar(
|
||||||
content: Text(
|
content: Text(
|
||||||
"${AppLocalizations.of(context).addToAlbumFailureNotification}: "
|
"${AppLocalizations.of(context).addToAlbumFailureNotification}: "
|
||||||
|
|
Loading…
Reference in a new issue