diff options
Diffstat (limited to 'src/fabric/src/fabric2_index.erl')
-rw-r--r-- | src/fabric/src/fabric2_index.erl | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/fabric/src/fabric2_index.erl b/src/fabric/src/fabric2_index.erl index 25c31a8c8..8d52e8b19 100644 --- a/src/fabric/src/fabric2_index.erl +++ b/src/fabric/src/fabric2_index.erl @@ -34,6 +34,7 @@ -include_lib("couch/include/couch_db.hrl"). +-include_lib("kernel/include/logger.hrl"). -callback build_indices(Db :: map(), DDocs :: list(#doc{})) -> @@ -67,9 +68,15 @@ cleanup(Db) -> catch error:database_does_not_exist -> ok; - Tag:Reason -> - Stack = erlang:get_stacktrace(), + Tag:Reason:Stack -> DbName = fabric2_db:name(Db), + ?LOG_ERROR(#{ + what => index_cleanup_failure, + db => DbName, + tag => Tag, + details => Reason, + stacktrace => Stack + }), LogMsg = "~p failed to cleanup indices for `~s` ~p:~p ~p", couch_log:error(LogMsg, [?MODULE, DbName, Tag, Reason, Stack]) end. @@ -168,8 +175,14 @@ process_updates_iter([Db | Rest], Cont) -> catch error:database_does_not_exist -> ok; - Tag:Reason -> - Stack = erlang:get_stacktrace(), + Tag:Reason:Stack -> + ?LOG_ERROR(#{ + what => index_build_failure, + db => Db, + tag => Tag, + details => Reason, + stacktrace => Stack + }), LogMsg = "~p failed to build indices for `~s` ~p:~p ~p", couch_log:error(LogMsg, [?MODULE, Db, Tag, Reason, Stack]) end, |