diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3a0af89ff..ddaf6476a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ on: workflow_dispatch: env: - XC_VERSION: ${{ '15.4' }} + XC_VERSION: ${{ '16_beta_6' }} jobs: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 5a161b672..ed93429b8 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -6,7 +6,7 @@ on: workflow_dispatch: env: - XC_VERSION: ${{ '15.4' }} + XC_VERSION: ${{ '16_beta_6' }} jobs: analyze: diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index cee6f92c6..44caca80f 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -6,7 +6,7 @@ on: - cron: '0 3 * * *' # at 03:00 AM UTC everyday env: - XC_VERSION: ${{ '15.4' }} + XC_VERSION: ${{ '16_beta_6' }} jobs: build: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 03e04c63a..4a4280156 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: env: - XC_VERSION: ${{ '15.4' }} + XC_VERSION: ${{ '16_beta_6' }} jobs: build: diff --git a/3rd_Party/AppAuth/built/libAppAuth-macOS.a b/3rd_Party/AppAuth/built/libAppAuth-macOS.a index cf8028b4b..d9554dfa0 100644 Binary files a/3rd_Party/AppAuth/built/libAppAuth-macOS.a and b/3rd_Party/AppAuth/built/libAppAuth-macOS.a differ diff --git a/3rd_Party/LetsMove/LetsMove.framework/Versions/A/LetsMove b/3rd_Party/LetsMove/LetsMove.framework/Versions/A/LetsMove index 1dcdee23d..3968563c9 100755 Binary files a/3rd_Party/LetsMove/LetsMove.framework/Versions/A/LetsMove and b/3rd_Party/LetsMove/LetsMove.framework/Versions/A/LetsMove differ diff --git a/3rd_Party/LetsMove/LetsMove.framework/Versions/A/Resources/Info.plist b/3rd_Party/LetsMove/LetsMove.framework/Versions/A/Resources/Info.plist index 4b8db2cf8..d54e85056 100644 --- a/3rd_Party/LetsMove/LetsMove.framework/Versions/A/Resources/Info.plist +++ b/3rd_Party/LetsMove/LetsMove.framework/Versions/A/Resources/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 23F79 + 23G93 CFBundleDevelopmentRegion en CFBundleExecutable @@ -27,19 +27,19 @@ DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - + 24A5324a DTPlatformName macosx DTPlatformVersion - 14.5 + 15.0 DTSDKBuild - 23F73 + 24A5324a DTSDKName - macosx14.5 + macosx15.0 DTXcode - 1540 + 1600 DTXcodeBuild - 15F31d + 16A5230g LSMinimumSystemVersion 10.15 NSHumanReadableCopyright diff --git a/3rd_Party/LetsMove/LetsMove.framework/Versions/A/_CodeSignature/CodeResources b/3rd_Party/LetsMove/LetsMove.framework/Versions/A/_CodeSignature/CodeResources index 4ffc05c3f..db9e7ea81 100644 --- a/3rd_Party/LetsMove/LetsMove.framework/Versions/A/_CodeSignature/CodeResources +++ b/3rd_Party/LetsMove/LetsMove.framework/Versions/A/_CodeSignature/CodeResources @@ -6,7 +6,7 @@ Resources/Info.plist - LchtjyN8W2fLAdQr3j41KTCVACs= + 2xJ7lfxk9XAbUydRh3k0fvG3qQI= Resources/ca.lproj/MoveApplication.strings @@ -270,7 +270,7 @@ hash2 - RIkAfiFxvLdquGjE8kMHVIbzhI9CgdqjMQqz2eEoHHU= + BG/mNxhn1q8hf3Zm7htjGru7bvR4/8KJrviV1DpFKuA= Resources/ca.lproj/MoveApplication.strings diff --git a/3rd_Party/OpenSSL/lib/libcrypto.a b/3rd_Party/OpenSSL/lib/libcrypto.a index 3d37e05a9..8137d3253 100644 Binary files a/3rd_Party/OpenSSL/lib/libcrypto.a and b/3rd_Party/OpenSSL/lib/libcrypto.a differ diff --git a/3rd_Party/OpenSSL/lib/libssl.a b/3rd_Party/OpenSSL/lib/libssl.a index 67a03d2bd..115e0e654 100644 Binary files a/3rd_Party/OpenSSL/lib/libssl.a and b/3rd_Party/OpenSSL/lib/libssl.a differ diff --git a/3rd_Party/Sparkle/Sparkle.framework/Versions/B/Autoupdate b/3rd_Party/Sparkle/Sparkle.framework/Versions/B/Autoupdate index 1d932b0da..48af54bbd 100755 Binary files a/3rd_Party/Sparkle/Sparkle.framework/Versions/B/Autoupdate and b/3rd_Party/Sparkle/Sparkle.framework/Versions/B/Autoupdate differ diff --git a/3rd_Party/Sparkle/Sparkle.framework/Versions/B/Resources/Info.plist b/3rd_Party/Sparkle/Sparkle.framework/Versions/B/Resources/Info.plist index 8bd08c8e2..a7f31626b 100644 --- a/3rd_Party/Sparkle/Sparkle.framework/Versions/B/Resources/Info.plist +++ b/3rd_Party/Sparkle/Sparkle.framework/Versions/B/Resources/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 23F79 + 23G93 CFBundleDevelopmentRegion en CFBundleExecutable @@ -29,19 +29,19 @@ DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - + 24A5324a DTPlatformName macosx DTPlatformVersion - 14.5 + 15.0 DTSDKBuild - 23F73 + 24A5324a DTSDKName - macosx14.5 + macosx15.0 DTXcode - 1540 + 1600 DTXcodeBuild - 15F31d + 16A5230g LSMinimumSystemVersion 10.13 diff --git a/3rd_Party/Sparkle/Sparkle.framework/Versions/B/Sparkle b/3rd_Party/Sparkle/Sparkle.framework/Versions/B/Sparkle index 6a7f9b2c6..d9ea476ac 100755 Binary files a/3rd_Party/Sparkle/Sparkle.framework/Versions/B/Sparkle and b/3rd_Party/Sparkle/Sparkle.framework/Versions/B/Sparkle differ diff --git a/3rd_Party/Sparkle/Sparkle.framework/Versions/B/Updater.app/Contents/Info.plist b/3rd_Party/Sparkle/Sparkle.framework/Versions/B/Updater.app/Contents/Info.plist index 2f048b50a..06ea22038 100644 --- a/3rd_Party/Sparkle/Sparkle.framework/Versions/B/Updater.app/Contents/Info.plist +++ b/3rd_Party/Sparkle/Sparkle.framework/Versions/B/Updater.app/Contents/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 23F79 + 23G93 CFBundleDevelopmentRegion en CFBundleExecutable @@ -67,19 +67,19 @@ DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - + 24A5324a DTPlatformName macosx DTPlatformVersion - 14.5 + 15.0 DTSDKBuild - 23F73 + 24A5324a DTSDKName - macosx14.5 + macosx15.0 DTXcode - 1540 + 1600 DTXcodeBuild - 15F31d + 16A5230g LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/3rd_Party/Sparkle/Sparkle.framework/Versions/B/Updater.app/Contents/MacOS/Updater b/3rd_Party/Sparkle/Sparkle.framework/Versions/B/Updater.app/Contents/MacOS/Updater index c24f1aa87..798ab3588 100755 Binary files a/3rd_Party/Sparkle/Sparkle.framework/Versions/B/Updater.app/Contents/MacOS/Updater and b/3rd_Party/Sparkle/Sparkle.framework/Versions/B/Updater.app/Contents/MacOS/Updater differ diff --git a/3rd_Party/Sparkle/Sparkle.framework/Versions/B/XPCServices/Downloader.xpc/Contents/Info.plist b/3rd_Party/Sparkle/Sparkle.framework/Versions/B/XPCServices/Downloader.xpc/Contents/Info.plist index 689bd1dd2..0fe5036bb 100644 --- a/3rd_Party/Sparkle/Sparkle.framework/Versions/B/XPCServices/Downloader.xpc/Contents/Info.plist +++ b/3rd_Party/Sparkle/Sparkle.framework/Versions/B/XPCServices/Downloader.xpc/Contents/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 23F79 + 23G93 CFBundleDevelopmentRegion en CFBundleExecutable @@ -29,19 +29,19 @@ DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - + 24A5324a DTPlatformName macosx DTPlatformVersion - 14.5 + 15.0 DTSDKBuild - 23F73 + 24A5324a DTSDKName - macosx14.5 + macosx15.0 DTXcode - 1540 + 1600 DTXcodeBuild - 15F31d + 16A5230g LSMinimumSystemVersion 10.13 NSAppTransportSecurity diff --git a/3rd_Party/Sparkle/Sparkle.framework/Versions/B/XPCServices/Downloader.xpc/Contents/MacOS/Downloader b/3rd_Party/Sparkle/Sparkle.framework/Versions/B/XPCServices/Downloader.xpc/Contents/MacOS/Downloader index c2a76ab50..b9824c17c 100755 Binary files a/3rd_Party/Sparkle/Sparkle.framework/Versions/B/XPCServices/Downloader.xpc/Contents/MacOS/Downloader and b/3rd_Party/Sparkle/Sparkle.framework/Versions/B/XPCServices/Downloader.xpc/Contents/MacOS/Downloader differ diff --git a/3rd_Party/Sparkle/Sparkle.framework/Versions/B/XPCServices/Installer.xpc/Contents/Info.plist b/3rd_Party/Sparkle/Sparkle.framework/Versions/B/XPCServices/Installer.xpc/Contents/Info.plist index 3761ecbb5..09989ae75 100644 --- a/3rd_Party/Sparkle/Sparkle.framework/Versions/B/XPCServices/Installer.xpc/Contents/Info.plist +++ b/3rd_Party/Sparkle/Sparkle.framework/Versions/B/XPCServices/Installer.xpc/Contents/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 23F79 + 23G93 CFBundleDevelopmentRegion en CFBundleExecutable @@ -29,19 +29,19 @@ DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - + 24A5324a DTPlatformName macosx DTPlatformVersion - 14.5 + 15.0 DTSDKBuild - 23F73 + 24A5324a DTSDKName - macosx14.5 + macosx15.0 DTXcode - 1540 + 1600 DTXcodeBuild - 15F31d + 16A5230g LSMinimumSystemVersion 10.13 NSHumanReadableCopyright diff --git a/3rd_Party/Sparkle/Sparkle.framework/Versions/B/XPCServices/Installer.xpc/Contents/MacOS/Installer b/3rd_Party/Sparkle/Sparkle.framework/Versions/B/XPCServices/Installer.xpc/Contents/MacOS/Installer index 4b8ae8b62..c8cc4e699 100755 Binary files a/3rd_Party/Sparkle/Sparkle.framework/Versions/B/XPCServices/Installer.xpc/Contents/MacOS/Installer and b/3rd_Party/Sparkle/Sparkle.framework/Versions/B/XPCServices/Installer.xpc/Contents/MacOS/Installer differ diff --git a/3rd_Party/Sparkle/Sparkle.framework/Versions/B/_CodeSignature/CodeResources b/3rd_Party/Sparkle/Sparkle.framework/Versions/B/_CodeSignature/CodeResources index 2ea5b481c..577970553 100644 --- a/3rd_Party/Sparkle/Sparkle.framework/Versions/B/_CodeSignature/CodeResources +++ b/3rd_Party/Sparkle/Sparkle.framework/Versions/B/_CodeSignature/CodeResources @@ -22,7 +22,7 @@ Resources/Info.plist - vbThLOecOFzZs5c73SswIUHAQn8= + CU9SOhCb7nYLmmQmJ5/NUIXgKig= Resources/ReleaseNotesColorStyle.css @@ -939,10 +939,10 @@ cdhash - Fr9dsunrnNRMocbZmEF8cP1nnpg= + 0tP0lDyqGENjO38pU4Ou/nd9vWw= requirement - cdhash H"16bf5db2e9eb9cd44ca1c6d998417c70fd679e98" or cdhash H"5b0b9e5a1caeac7527be86fe3c27bd58aac73ecd" + cdhash H"d2d3f4943caa1843633b7f295383aefe777dbd6c" or cdhash H"b958b1f76c4f2ae3d6b843a7ddc2279c7bc77700" Headers/SPUDownloadData.h @@ -1186,7 +1186,7 @@ hash2 - 1FpNwahKoFCadHstLOC9OeKkNAQ5mE1Mtmgx0/JaTlU= + 4eIah47zOTXNyKQH/yKsb7Mg9oQD0h1kkVKr1rGDJlY= Resources/ReleaseNotesColorStyle.css @@ -2107,28 +2107,28 @@ cdhash - 5tsZt2a/TMYDmh2slp6d3ibEen8= + tooTko0dE29snYyRAxnWxvqP+lc= requirement - cdhash H"e6db19b766bf4cc6039a1dac969e9dde26c47a7f" or cdhash H"a98ea185d0bc0b8f1684dd967b5c72358b09b0cd" + cdhash H"b68a13928d1d136f6c9d8c910319d6c6fa8ffa57" or cdhash H"80defc6b85ef53f965055cbe43e1be46056f9bae" XPCServices/Downloader.xpc cdhash - tQxSTgy8hxjRI4We12og2TBCics= + A+xHakKuGXizsz6k3xifwWuafzw= requirement - cdhash H"b50c524e0cbc8718d123859ed76a20d9304289cb" or cdhash H"b9ef2c32b236930c5c11b098dcc8236da2d33c3d" + cdhash H"03ec476a42ae1978b3b33ea4df189fc16b9a7f3c" or cdhash H"2e8bf408dc29a6159a27bc57dfac39fdea3093b4" XPCServices/Installer.xpc cdhash - AuoSZAgXGf3dUo7LU0wHSXdXrA8= + 0M5djLhamWuot0RTeXljgaaNKJg= requirement - cdhash H"02ea1264081719fddd528ecb534c07497757ac0f" or cdhash H"86569414135260b525546d703fa21b40263b071a" + cdhash H"d0ce5d8cb85a996ba8b7445379796381a68d2898" or cdhash H"e77e789ad007a20a6ab38608b1991aa494aa9ffe" rules diff --git a/3rd_Party/bz2/lib/libbz2.a b/3rd_Party/bz2/lib/libbz2.a index 2947264ee..f26a4419e 100644 Binary files a/3rd_Party/bz2/lib/libbz2.a and b/3rd_Party/bz2/lib/libbz2.a differ diff --git a/3rd_Party/fmt/lib/libfmt.a b/3rd_Party/fmt/lib/libfmt.a index 08f83dba0..603a3005f 100644 Binary files a/3rd_Party/fmt/lib/libfmt.a and b/3rd_Party/fmt/lib/libfmt.a differ diff --git a/3rd_Party/googletest/lib/libgmock.a b/3rd_Party/googletest/lib/libgmock.a index eeaf6916e..8c3085f48 100644 Binary files a/3rd_Party/googletest/lib/libgmock.a and b/3rd_Party/googletest/lib/libgmock.a differ diff --git a/3rd_Party/googletest/lib/libgmock_main.a b/3rd_Party/googletest/lib/libgmock_main.a index a6d91cf19..c12f670be 100644 Binary files a/3rd_Party/googletest/lib/libgmock_main.a and b/3rd_Party/googletest/lib/libgmock_main.a differ diff --git a/3rd_Party/googletest/lib/libgtest.a b/3rd_Party/googletest/lib/libgtest.a index b694da79f..df74ae51c 100644 Binary files a/3rd_Party/googletest/lib/libgtest.a and b/3rd_Party/googletest/lib/libgtest.a differ diff --git a/3rd_Party/googletest/lib/libgtest_main.a b/3rd_Party/googletest/lib/libgtest_main.a index 5f6c407bd..cb897f9ca 100644 Binary files a/3rd_Party/googletest/lib/libgtest_main.a and b/3rd_Party/googletest/lib/libgtest_main.a differ diff --git a/3rd_Party/lexilla/lib/liblexilla.a b/3rd_Party/lexilla/lib/liblexilla.a index f6f457e79..9934bca96 100644 Binary files a/3rd_Party/lexilla/lib/liblexilla.a and b/3rd_Party/lexilla/lib/liblexilla.a differ diff --git a/3rd_Party/libarchive/bootstrap.sh b/3rd_Party/libarchive/bootstrap.sh index 74ac5dc58..28b55a38e 100755 --- a/3rd_Party/libarchive/bootstrap.sh +++ b/3rd_Party/libarchive/bootstrap.sh @@ -48,7 +48,7 @@ libarchive_test_read_format_lha_filename|\ libarchive_test_read_format_zip_filename_CP932_eucJP|\ libarchive_test_read_format_zip_filename_CP932_CP932|\ libarchive_test_sparse_basic|libarchive_test_ustar_filename_encoding_EUCJP_CP932" \ - --testing-dir . + --test-dir . cd ./../../ rm -rf ./include/ diff --git a/3rd_Party/libarchive/lib/libarchive.a b/3rd_Party/libarchive/lib/libarchive.a index 6149e3580..0c0ef2834 100644 Binary files a/3rd_Party/libarchive/lib/libarchive.a and b/3rd_Party/libarchive/lib/libarchive.a differ diff --git a/3rd_Party/libcurl/lib/libcurl.a b/3rd_Party/libcurl/lib/libcurl.a index 4ea69b866..9df6d4540 100644 Binary files a/3rd_Party/libcurl/lib/libcurl.a and b/3rd_Party/libcurl/lib/libcurl.a differ diff --git a/3rd_Party/libcxxbackport/lib/libcxxbackport.a b/3rd_Party/libcxxbackport/lib/libcxxbackport.a index 82179855b..e814050bf 100644 Binary files a/3rd_Party/libcxxbackport/lib/libcxxbackport.a and b/3rd_Party/libcxxbackport/lib/libcxxbackport.a differ diff --git a/3rd_Party/libssh2/lib/libssh2.a b/3rd_Party/libssh2/lib/libssh2.a index b4e310dab..bbd24cf0c 100644 Binary files a/3rd_Party/libssh2/lib/libssh2.a and b/3rd_Party/libssh2/lib/libssh2.a differ diff --git a/3rd_Party/lz4/lib/liblz4.a b/3rd_Party/lz4/lib/liblz4.a index 5fcc762aa..9bdb5f00b 100644 Binary files a/3rd_Party/lz4/lib/liblz4.a and b/3rd_Party/lz4/lib/liblz4.a differ diff --git a/3rd_Party/lzma/lib/liblzma.a b/3rd_Party/lzma/lib/liblzma.a index d9c76a05b..ffe4fb729 100644 Binary files a/3rd_Party/lzma/lib/liblzma.a and b/3rd_Party/lzma/lib/liblzma.a differ diff --git a/3rd_Party/lzo/lib/liblzo2.a b/3rd_Party/lzo/lib/liblzo2.a index e243fee90..b7539b106 100644 Binary files a/3rd_Party/lzo/lib/liblzo2.a and b/3rd_Party/lzo/lib/liblzo2.a differ diff --git a/3rd_Party/pstld/lib/libpstld.a b/3rd_Party/pstld/lib/libpstld.a index 3b827b6d7..9e60c0fe7 100644 Binary files a/3rd_Party/pstld/lib/libpstld.a and b/3rd_Party/pstld/lib/libpstld.a differ diff --git a/3rd_Party/pugixml/lib/libpugixml.a b/3rd_Party/pugixml/lib/libpugixml.a index b20973178..325920ee5 100644 Binary files a/3rd_Party/pugixml/lib/libpugixml.a and b/3rd_Party/pugixml/lib/libpugixml.a differ diff --git a/3rd_Party/re2/lib/libre2.a b/3rd_Party/re2/lib/libre2.a index f12a34644..960a18b5a 100644 Binary files a/3rd_Party/re2/lib/libre2.a and b/3rd_Party/re2/lib/libre2.a differ diff --git a/3rd_Party/spdlog/lib/libspdlog.a b/3rd_Party/spdlog/lib/libspdlog.a index e30d7be57..5b771712f 100644 Binary files a/3rd_Party/spdlog/lib/libspdlog.a and b/3rd_Party/spdlog/lib/libspdlog.a differ diff --git a/3rd_Party/z/lib/libz.a b/3rd_Party/z/lib/libz.a index 686c8950c..c559e1686 100644 Binary files a/3rd_Party/z/lib/libz.a and b/3rd_Party/z/lib/libz.a differ diff --git a/3rd_Party/zstd/lib/libzstd.a b/3rd_Party/zstd/lib/libzstd.a index e11280ea9..7685f4960 100644 Binary files a/3rd_Party/zstd/lib/libzstd.a and b/3rd_Party/zstd/lib/libzstd.a differ diff --git a/Source/Base/include/Base/SpdlogFacade.h b/Source/Base/include/Base/SpdlogFacade.h index 09b3b7d8f..31e5dfd4e 100644 --- a/Source/Base/include/Base/SpdlogFacade.h +++ b/Source/Base/include/Base/SpdlogFacade.h @@ -5,16 +5,9 @@ #include #include #include +#include #include "SpdlogFormatters.h" -#ifndef SPDLOC -#define SPDLOC \ - spdlog::source_loc \ - { \ - __FILE__, __LINE__, __FUNCTION__ \ - } -#endif - namespace nc::base { class SpdLogger @@ -32,6 +25,17 @@ class SpdLogger std::vector> m_OldLoggers; }; +struct SpdlogLocAndFmt { + template + constexpr SpdlogLocAndFmt(const String &_fmt, const std::source_location &_loc = std::source_location::current()) + : fmt{_fmt}, loc{_loc.file_name(), static_cast(_loc.line()), _loc.function_name()} + { + } + + std::string_view fmt; + spdlog::source_loc loc; +}; + template class SpdlogFacade { @@ -49,39 +53,39 @@ class SpdlogFacade static void Set(std::shared_ptr _logger) noexcept { Impl::m_Logger.Set(_logger); } template - static void Trace(spdlog::source_loc _loc, std::string_view _fmt, const Args &...args) + static void Trace(SpdlogLocAndFmt _locfmt, const Args &...args) { - Get().log(_loc, spdlog::level::trace, fmt::runtime(_fmt), args...); + Get().log(_locfmt.loc, spdlog::level::trace, fmt::runtime(_locfmt.fmt), args...); } template - static void Debug(spdlog::source_loc _loc, std::string_view _fmt, const Args &...args) + static void Debug(SpdlogLocAndFmt _locfmt, const Args &...args) { - Get().log(_loc, spdlog::level::debug, fmt::runtime(_fmt), args...); + Get().log(_locfmt.loc, spdlog::level::debug, fmt::runtime(_locfmt.fmt), args...); } template - static void Info(spdlog::source_loc _loc, std::string_view _fmt, const Args &...args) + static void Info(SpdlogLocAndFmt _locfmt, const Args &...args) { - Get().log(_loc, spdlog::level::info, fmt::runtime(_fmt), args...); + Get().log(_locfmt.loc, spdlog::level::info, fmt::runtime(_locfmt.fmt), args...); } template - static void Warn(spdlog::source_loc _loc, std::string_view _fmt, const Args &...args) + static void Warn(SpdlogLocAndFmt _locfmt, const Args &...args) { - Get().log(_loc, spdlog::level::warn, fmt::runtime(_fmt), args...); + Get().log(_locfmt.loc, spdlog::level::warn, fmt::runtime(_locfmt.fmt), args...); } template - static void Error(spdlog::source_loc _loc, std::string_view _fmt, const Args &...args) + static void Error(SpdlogLocAndFmt _locfmt, const Args &...args) { - Get().log(_loc, spdlog::level::err, fmt::runtime(_fmt), args...); + Get().log(_locfmt.loc, spdlog::level::err, fmt::runtime(_locfmt.fmt), args...); } template - static void Critical(spdlog::source_loc _loc, std::string_view _fmt, const Args &...args) + static void Critical(SpdlogLocAndFmt _locfmt, const Args &...args) { - Get().log(_loc, spdlog::level::critical, fmt::runtime(_fmt), args...); + Get().log(_locfmt.loc, spdlog::level::critical, fmt::runtime(_locfmt.fmt), args...); } }; diff --git a/Source/Config/source/ConfigImpl.cpp b/Source/Config/source/ConfigImpl.cpp index ac31d10fe..8cb8a8467 100644 --- a/Source/Config/source/ConfigImpl.cpp +++ b/Source/Config/source/ConfigImpl.cpp @@ -80,7 +80,7 @@ Value ConfigImpl::Get(std::string_view _path) const if( const auto value = FindInDocument_Unlocked(_path) ) return Value{*value, g_CrtAllocator}; } - Log::Error(SPDLOC, "Couldn't find config path: {}", _path); + Log::Error("Couldn't find config path: {}", _path); return Value{rapidjson::kNullType}; } @@ -91,7 +91,7 @@ Value ConfigImpl::GetDefault(std::string_view _path) const if( const auto value = FindInDefaults_Unlocked(_path) ) return Value{*value, g_CrtAllocator}; } - Log::Error(SPDLOC, "Couldn't find config path: {}", _path); + Log::Error("Couldn't find config path: {}", _path); return Value{rapidjson::kNullType}; } @@ -104,11 +104,11 @@ std::string ConfigImpl::GetString(std::string_view _path) const noexcept return std::string{value->GetString(), value->GetStringLength()}; } else { - Log::Error(SPDLOC, "Config path doesn't contain a string: {}", _path); + Log::Error("Config path doesn't contain a string: {}", _path); } } else { - Log::Error(SPDLOC, "Couldn't find config path: {}", _path); + Log::Error("Couldn't find config path: {}", _path); } } return {}; @@ -121,7 +121,7 @@ bool ConfigImpl::GetBool(std::string_view _path) const noexcept if( const auto value = FindInDocument_Unlocked(_path) ) return value->GetType() == rapidjson::kTrueType; } - Log::Error(SPDLOC, "Couldn't find config path: {}", _path); + Log::Error("Couldn't find config path: {}", _path); return false; } @@ -150,11 +150,11 @@ int ConfigImpl::GetInt(std::string_view _path) const noexcept return ExtractNumericAs(*value); } else { - Log::Error(SPDLOC, "Config path doesn't contain a number: {}", _path); + Log::Error("Config path doesn't contain a number: {}", _path); } } else { - Log::Error(SPDLOC, "Couldn't find config path: {}", _path); + Log::Error("Couldn't find config path: {}", _path); } return 0; } @@ -167,11 +167,11 @@ unsigned int ConfigImpl::GetUInt(std::string_view _path) const noexcept return ExtractNumericAs(*value); } else { - Log::Error(SPDLOC, "Config path doesn't contain a number: {}", _path); + Log::Error("Config path doesn't contain a number: {}", _path); } } else { - Log::Error(SPDLOC, "Couldn't find config path: {}", _path); + Log::Error("Couldn't find config path: {}", _path); } return 0; } @@ -184,11 +184,11 @@ long ConfigImpl::GetLong(std::string_view _path) const noexcept return ExtractNumericAs(*value); } else { - Log::Error(SPDLOC, "Config path doesn't contain a number: {}", _path); + Log::Error("Config path doesn't contain a number: {}", _path); } } else { - Log::Error(SPDLOC, "Couldn't find config path: {}", _path); + Log::Error("Couldn't find config path: {}", _path); } return 0; } @@ -201,11 +201,11 @@ unsigned long ConfigImpl::GetULong(std::string_view _path) const noexcept return ExtractNumericAs(*value); } else { - Log::Error(SPDLOC, "Config path doesn't contain a number: {}", _path); + Log::Error("Config path doesn't contain a number: {}", _path); } } else { - Log::Error(SPDLOC, "Couldn't find config path: {}", _path); + Log::Error("Couldn't find config path: {}", _path); } return 0; } @@ -218,11 +218,11 @@ double ConfigImpl::GetDouble(std::string_view _path) const noexcept return ExtractNumericAs(*value); } else { - Log::Error(SPDLOC, "Config path doesn't contain a number: {}", _path); + Log::Error("Config path doesn't contain a number: {}", _path); } } else { - Log::Error(SPDLOC, "Couldn't find config path: {}", _path); + Log::Error("Couldn't find config path: {}", _path); } return 0.; } diff --git a/Source/Config/source/FileOverwritesStorage.cpp b/Source/Config/source/FileOverwritesStorage.cpp index ee47c65b9..5d5b2fe84 100644 --- a/Source/Config/source/FileOverwritesStorage.cpp +++ b/Source/Config/source/FileOverwritesStorage.cpp @@ -18,9 +18,9 @@ static time_t ModificationTime(const std::string &_filepath); FileOverwritesStorage::FileOverwritesStorage(const std::filesystem::path &_file_path) : m_Path(_file_path) { - Log::Trace(SPDLOC, "Created storage with path: {}", _file_path); + Log::Trace("Created storage with path: {}", _file_path); auto parent_path = _file_path.parent_path(); - Log::Trace(SPDLOC, "Setting observation for directory: {}", parent_path); + Log::Trace("Setting observation for directory: {}", parent_path); m_DirObservationTicket = FSEventsDirUpdate::Instance().AddWatchPath(parent_path.c_str(), [this] { OverwritesDirChanged(); }); } @@ -28,18 +28,18 @@ FileOverwritesStorage::FileOverwritesStorage(const std::filesystem::path &_file_ FileOverwritesStorage::~FileOverwritesStorage() { FSEventsDirUpdate::Instance().RemoveWatchPathWithTicket(m_DirObservationTicket); - Log::Trace(SPDLOC, "Instance destroyed"); + Log::Trace("Instance destroyed"); } std::optional FileOverwritesStorage::Read() const { auto file_contents = Load(m_Path); if( file_contents ) { - Log::Info(SPDLOC, "Successfully read overwrites from {}", m_Path); + Log::Info("Successfully read overwrites from {}", m_Path); m_OverwritesTime = ModificationTime(m_Path); } else { - Log::Info(SPDLOC, "Failed to read overwrites from {}", m_Path); + Log::Info("Failed to read overwrites from {}", m_Path); } return file_contents; } @@ -49,11 +49,11 @@ void FileOverwritesStorage::Write(std::string_view _overwrites_json) const auto bytes = std::span(reinterpret_cast(_overwrites_json.data()), _overwrites_json.length()); if( base::WriteAtomically(m_Path, bytes) ) { - Log::Info(SPDLOC, "Successfully written overwrites to {}", m_Path); + Log::Info("Successfully written overwrites to {}", m_Path); m_OverwritesTime = ModificationTime(m_Path); } else { - Log::Error(SPDLOC, "Failed to write overwrites to {}", m_Path); + Log::Error("Failed to write overwrites to {}", m_Path); } } @@ -64,7 +64,7 @@ void FileOverwritesStorage::SetExternalChangeCallback(std::function _cal void FileOverwritesStorage::OverwritesDirChanged() { - Log::Info(SPDLOC, "Overwrites directory was changed"); + Log::Info("Overwrites directory was changed"); const auto current_time = ModificationTime(m_Path); if( current_time != m_OverwritesTime ) { m_OverwritesTime = current_time; diff --git a/Source/NimbleCommander/NimbleCommander/Core/ConfigBackedNetworkConnectionsManager.h b/Source/NimbleCommander/NimbleCommander/Core/ConfigBackedNetworkConnectionsManager.h index 157e9b7f2..60ab8a3a2 100644 --- a/Source/NimbleCommander/NimbleCommander/Core/ConfigBackedNetworkConnectionsManager.h +++ b/Source/NimbleCommander/NimbleCommander/Core/ConfigBackedNetworkConnectionsManager.h @@ -1,9 +1,10 @@ -// Copyright (C) 2015-2023 Michael Kazakov. Subject to GNU General Public License version 3. +// Copyright (C) 2015-2024 Michael Kazakov. Subject to GNU General Public License version 3. #pragma once #include "NetworkConnectionsManager.h" #include #include +#include namespace nc::utility { class NativeFSManager; diff --git a/Source/NimbleCommander/NimbleCommander/Core/LaunchServices.mm b/Source/NimbleCommander/NimbleCommander/Core/LaunchServices.mm index 06ef18758..33f59d82b 100644 --- a/Source/NimbleCommander/NimbleCommander/Core/LaunchServices.mm +++ b/Source/NimbleCommander/NimbleCommander/Core/LaunchServices.mm @@ -1,4 +1,4 @@ -// Copyright (C) 2013-2021 Michael Kazakov. Subject to GNU General Public License version 3. +// Copyright (C) 2013-2024 Michael Kazakov. Subject to GNU General Public License version 3. #include "LaunchServices.h" #include #include @@ -6,6 +6,7 @@ #include #include #include +#include namespace nc::core { diff --git a/Source/NimbleCommander/NimbleCommander/States/FilePanels/Brief/PanelBriefView.mm b/Source/NimbleCommander/NimbleCommander/States/FilePanels/Brief/PanelBriefView.mm index dce17af3b..fcc4eef96 100644 --- a/Source/NimbleCommander/NimbleCommander/States/FilePanels/Brief/PanelBriefView.mm +++ b/Source/NimbleCommander/NimbleCommander/States/FilePanels/Brief/PanelBriefView.mm @@ -227,18 +227,15 @@ - (void)observeValueForKeyPath:(NSString *)keyPath - (NSInteger)collectionView:(NSCollectionView *) [[maybe_unused]] collectionView numberOfItemsInSection:(NSInteger) [[maybe_unused]] section { - Log::Trace(SPDLOC, - "[PanelBriefView collectionView:{} numberOfItemsInSection:{}]", - (__bridge void *)collectionView, - section); + Log::Trace( + "[PanelBriefView collectionView:{} numberOfItemsInSection:{}]", (__bridge void *)collectionView, section); return m_Data ? m_Data->SortedDirectoryEntries().size() : 0; } - (NSCollectionViewItem *)collectionView:(NSCollectionView *)collectionView itemForRepresentedObjectAtIndexPath:(NSIndexPath *)indexPath { - Log::Trace(SPDLOC, - "[PanelBriefView collectionView:{} itemForRepresentedObjectAtIndexPath:{}]", + Log::Trace("[PanelBriefView collectionView:{} itemForRepresentedObjectAtIndexPath:{}]", (__bridge void *)collectionView, indexPath.item); PanelBriefViewItem *item = [collectionView makeItemWithIdentifier:@"A" forIndexPath:indexPath]; @@ -304,8 +301,8 @@ static void PadWithSpaceForTags(std::span _widths, const data::M - (void)calculateFilenamesWidths { - Log::Trace(SPDLOC, "[PanelBriefView calculateFilenamesWidths] started"); - at_scope_end([] { Log::Trace(SPDLOC, "[PanelBriefView calculateFilenamesWidths] finished"); }); + Log::Trace("[PanelBriefView calculateFilenamesWidths] started"); + at_scope_end([] { Log::Trace("[PanelBriefView calculateFilenamesWidths] finished"); }); const auto strings = GatherDisplayFilenames(m_Data); const auto count = static_cast(strings.size()); @@ -389,7 +386,7 @@ - (void)updateItemsLayoutEngine - (void)calculateItemLayout { - Log::Trace(SPDLOC, "[PanelBriefView calculateItemLayout]"); + Log::Trace("[PanelBriefView calculateItemLayout]"); m_ItemLayout = BuildItemsLayout(nc::CurrentTheme().FilePanelsBriefFont(), m_ColumnsLayout); [self updateItemsLayoutEngine]; @@ -420,7 +417,7 @@ - (void)viewDidMoveToWindow - (void)dataChanged { - Log::Trace(SPDLOC, "[PanelBriefView dataChanged]"); + Log::Trace("[PanelBriefView dataChanged]"); dispatch_assert_main_queue(); assert(m_Data); [self calculateFilenamesWidths]; @@ -441,7 +438,7 @@ - (int)cursorPosition - (void)ensureItemIsVisible:(int)_item_index { - Log::Trace(SPDLOC, "[PanelBriefView ensureItemIsVisible:{}]", _item_index); + Log::Trace("[PanelBriefView ensureItemIsVisible:{}]", _item_index); if( _item_index < 0 ) return; @@ -492,7 +489,7 @@ - (void)ensureItemIsVisible:(int)_item_index - (void)setCursorPosition:(int)_cursor_position { - Log::Trace(SPDLOC, "[PanelBriefView setCursorPosition:{}]", _cursor_position); + Log::Trace("[PanelBriefView setCursorPosition:{}]", _cursor_position); if( self.cursorPosition == _cursor_position ) return; @@ -516,7 +513,7 @@ - (void)setCursorPosition:(int)_cursor_position - (bool)isItemVisible:(int)_sorted_item_index { - Log::Trace(SPDLOC, "[PanelBriefView isItemVisible:{}]", _sorted_item_index); + Log::Trace("[PanelBriefView isItemVisible:{}]", _sorted_item_index); const auto entries_count = [m_CollectionView numberOfItemsInSection:0]; if( _sorted_item_index < 0 || _sorted_item_index >= entries_count ) return false; @@ -535,13 +532,13 @@ - (void)setupFieldEditor:(NCPanelViewFieldEditor *)_editor forItemAtIndex:(int)_ - (int)itemsInColumn { - Log::Trace(SPDLOC, "[PanelBriefView itemsInColumn]"); + Log::Trace("[PanelBriefView itemsInColumn]"); return m_Layout.rowsNumber; } - (void)syncVolatileData { - Log::Trace(SPDLOC, "[PanelBriefView syncVolatileData]"); + Log::Trace("[PanelBriefView syncVolatileData]"); dispatch_assert_main_queue(); for( PanelBriefViewItem *i in m_CollectionView.visibleItems ) if( NSIndexPath *index_path = [m_CollectionView indexPathForItem:i] ) { @@ -667,7 +664,7 @@ - (void)themeDidChange - (void)collectionViewDidLayoutItems:(NSCollectionView *) [[maybe_unused]] collectionView { - Log::Trace(SPDLOC, "[PanelBriefView collectionViewDidLayoutItems:{}]", (__bridge void *)collectionView); + Log::Trace("[PanelBriefView collectionViewDidLayoutItems:{}]", (__bridge void *)collectionView); static const bool draws_grid = [m_CollectionView respondsToSelector:@selector(setBackgroundViewScrollsWithContent:)]; if( draws_grid ) diff --git a/Source/NimbleCommander/NimbleCommander/States/FilePanels/Brief/PanelBriefViewFixedNumberLayout.mm b/Source/NimbleCommander/NimbleCommander/States/FilePanels/Brief/PanelBriefViewFixedNumberLayout.mm index c1120bee1..bd57bf70d 100644 --- a/Source/NimbleCommander/NimbleCommander/States/FilePanels/Brief/PanelBriefViewFixedNumberLayout.mm +++ b/Source/NimbleCommander/NimbleCommander/States/FilePanels/Brief/PanelBriefViewFixedNumberLayout.mm @@ -40,20 +40,20 @@ - (instancetype)init - (NSSize)collectionViewContentSize { const auto sz = m_Engine.ContentSize(); - Log::Trace(SPDLOC, "[NCPanelBriefViewFixedNumberLayout collectionViewContentSize], return: {}", sz); + Log::Trace("[NCPanelBriefViewFixedNumberLayout collectionViewContentSize], return: {}", sz); return sz; } - (NSCollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)_index_path { const auto index = static_cast(_index_path.item); - Log::Trace(SPDLOC, "[NCPanelBriefViewFixedNumberLayout layoutAttributesForItemAtIndexPath={}]", index); + Log::Trace("[NCPanelBriefViewFixedNumberLayout layoutAttributesForItemAtIndexPath={}]", index); return m_Engine.AttributesForItemNumber(index); } - (NSArray *)layoutAttributesForElementsInRect:(NSRect)_rect { - Log::Trace(SPDLOC, "[NCPanelBriefViewFixedNumberLayout layoutAttributesForElementsInRect:{}]", _rect); + Log::Trace("[NCPanelBriefViewFixedNumberLayout layoutAttributesForElementsInRect:{}]", _rect); return m_Engine.AttributesForItemsInRect(_rect); } @@ -75,8 +75,7 @@ - (nullable NSCollectionViewLayoutAttributes *)layoutAttributesForDecorationView - (BOOL)shouldInvalidateLayoutForBoundsChange:(NSRect)_new_bounds { const auto result = m_Engine.ShouldRelayoutForNewBounds(_new_bounds); - Log::Trace(SPDLOC, - "[NCPanelBriefViewFixedNumberLayout shouldInvalidateLayoutForBoundsChange:{}], return: {}", + Log::Trace("[NCPanelBriefViewFixedNumberLayout shouldInvalidateLayoutForBoundsChange:{}], return: {}", _new_bounds, result); return result; @@ -84,7 +83,7 @@ - (BOOL)shouldInvalidateLayoutForBoundsChange:(NSRect)_new_bounds - (void)prepareLayout { - Log::Trace(SPDLOC, "[NCPanelBriefViewFixedNumberLayout prepareLayout]"); + Log::Trace("[NCPanelBriefViewFixedNumberLayout prepareLayout]"); const auto anchor = [self getColumnAnchor]; const auto collection_view = self.collectionView; const auto clip_bounds = collection_view.superview.bounds; diff --git a/Source/NimbleCommander/NimbleCommander/States/FilePanels/DragReceiver.mm b/Source/NimbleCommander/NimbleCommander/States/FilePanels/DragReceiver.mm index 1990fa72d..11f91d273 100644 --- a/Source/NimbleCommander/NimbleCommander/States/FilePanels/DragReceiver.mm +++ b/Source/NimbleCommander/NimbleCommander/States/FilePanels/DragReceiver.mm @@ -70,12 +70,11 @@ const auto destination = ComposeDestination(); if( destination ) - panel::Log::Trace(SPDLOC, - "DragReceiver::Validate() - dragging over path: {}{}", + panel::Log::Trace("DragReceiver::Validate() - dragging over path: {}{}", destination.Host()->JunctionPath(), destination.Path()); else - panel::Log::Trace(SPDLOC, "DragReceiver::Validate() - dragging over an empty destination"); + panel::Log::Trace("DragReceiver::Validate() - dragging over an empty destination"); if( destination && destination.Host()->IsWritable() ) { if( const auto source = objc_cast(m_Dragging.draggingSource) ) diff --git a/Source/NimbleCommander/NimbleCommander/States/FilePanels/FavoritesImpl.cpp b/Source/NimbleCommander/NimbleCommander/States/FilePanels/FavoritesImpl.cpp index 4863b4d33..c3dcbcc9a 100644 --- a/Source/NimbleCommander/NimbleCommander/States/FilePanels/FavoritesImpl.cpp +++ b/Source/NimbleCommander/NimbleCommander/States/FilePanels/FavoritesImpl.cpp @@ -136,10 +136,9 @@ FavoriteLocationsStorageImpl::FrecentlyUsed(int _amount) const if( recent_visits.empty() ) return {}; - const auto max_visits_it = - std::max_element(std::begin(recent_visits), std::end(recent_visits), [](auto &l, auto &r) { - return std::max(std::get<1>(l), std::get<1>(r)); - }); + const auto max_visits_it = std::max_element(std::begin(recent_visits), + std::end(recent_visits), + [](auto &l, auto &r) { return std::get<1>(l) < std::get<1>(r); }); const auto max_visits = float(std::get<1>(*max_visits_it)); for( auto &v : recent_visits ) { diff --git a/Source/NimbleCommander/NimbleCommander/States/FilePanels/PanelController.mm b/Source/NimbleCommander/NimbleCommander/States/FilePanels/PanelController.mm index 9d38e3093..d99efcdb2 100644 --- a/Source/NimbleCommander/NimbleCommander/States/FilePanels/PanelController.mm +++ b/Source/NimbleCommander/NimbleCommander/States/FilePanels/PanelController.mm @@ -376,7 +376,7 @@ - (void)changeHardFilteringTo:(data::HardFilter)_filter - (void)reloadRefreshedListing:(const VFSListingPtr &)_ptr { assert(dispatch_is_main_queue()); - Log::Info(SPDLOC, "Reloading refreshed listing, {}", _ptr->IsUniform() ? _ptr->Directory().c_str() : "uniform"); + Log::Info("Reloading refreshed listing, {}", _ptr->IsUniform() ? _ptr->Directory().c_str() : "uniform"); const auto pers = CursorBackup{m_View.curpos, m_Data}; @@ -385,7 +385,7 @@ - (void)reloadRefreshedListing:(const VFSListingPtr &)_ptr [m_QuickSearch dataUpdated]; if( [self checkAgainstRequestedFocusing] ) { - Log::Trace(SPDLOC, "Cursor position was changed by requested focusing, skipping RestoredCursorPosition()"); + Log::Trace("Cursor position was changed by requested focusing, skipping RestoredCursorPosition()"); } else { m_View.curpos = pers.RestoredCursorPosition(); @@ -991,7 +991,7 @@ - (void)scheduleDelayedFocusing:(const DelayedFocusing &)request if( request.filename.empty() ) return; - nc::panel::Log::Trace(SPDLOC, "[PanelController scheduleDelayedFocusing] called for '{}'", request.filename); + nc::panel::Log::Trace("[PanelController scheduleDelayedFocusing] called for '{}'", request.filename); m_DelayedSelection.request_end = nc::base::machtime() + request.timeout; m_DelayedSelection.filename = request.filename; @@ -1012,8 +1012,7 @@ - (bool)checkAgainstRequestedFocusing return false; if( nc::base::machtime() > m_DelayedSelection.request_end ) { - nc::panel::Log::Trace(SPDLOC, - "[PanelController checkAgainstRequestedFocusing] removing a stale request for '{}'", + nc::panel::Log::Trace("[PanelController checkAgainstRequestedFocusing] removing a stale request for '{}'", m_DelayedSelection.filename); [self clearFocusingRequest]; return false; @@ -1023,8 +1022,8 @@ - (bool)checkAgainstRequestedFocusing int raw_index = m_Data.RawIndexForName(m_DelayedSelection.filename); if( raw_index < 0 ) return false; - nc::panel::Log::Trace( - SPDLOC, "[PanelController checkAgainstRequestedFocusing] found an entry for '{}'", m_DelayedSelection.filename); + nc::panel::Log::Trace("[PanelController checkAgainstRequestedFocusing] found an entry for '{}'", + m_DelayedSelection.filename); // we found this entry. regardless of appearance of this entry in current directory presentation // there's no reason to search for it again diff --git a/Source/NimbleCommander/NimbleCommander/States/FilePanels/PanelView.mm b/Source/NimbleCommander/NimbleCommander/States/FilePanels/PanelView.mm index dc8e0ebad..0b1f046b2 100644 --- a/Source/NimbleCommander/NimbleCommander/States/FilePanels/PanelView.mm +++ b/Source/NimbleCommander/NimbleCommander/States/FilePanels/PanelView.mm @@ -1007,7 +1007,7 @@ - (NSString *)headerTitleForPanel - (void)panelItem:(int)_sorted_index mouseDown:(NSEvent *)_event { - nc::panel::Log::Trace(SPDLOC, "[PanelController panelItem:mouseDown:] called for sorted index '{}'", _sorted_index); + nc::panel::Log::Trace("[PanelController panelItem:mouseDown:] called for sorted index '{}'", _sorted_index); if( !self.window.isKeyWindow ) { // any cursor movements or selection changes should be performed only in active window @@ -1046,7 +1046,7 @@ - (void)panelItem:(int)_sorted_index fieldEditor:(NSEvent *) [[maybe_unused]] _e - (void)panelItem:(int)_sorted_index dblClick:(NSEvent *) [[maybe_unused]] _event { - nc::panel::Log::Trace(SPDLOC, "[PanelController panelItem:dblClick:] called for sorted index '{}'", _sorted_index); + nc::panel::Log::Trace("[PanelController panelItem:dblClick:] called for sorted index '{}'", _sorted_index); if( _sorted_index >= 0 && _sorted_index == m_CursorPos ) { if( auto action_dispatcher = self.actionsDispatcher ) [action_dispatcher OnOpen:self]; diff --git a/Source/NimbleCommander/NimbleCommander/States/Terminal/ShellState.mm b/Source/NimbleCommander/NimbleCommander/States/Terminal/ShellState.mm index 300cfc580..03b3e9f63 100644 --- a/Source/NimbleCommander/NimbleCommander/States/Terminal/ShellState.mm +++ b/Source/NimbleCommander/NimbleCommander/States/Terminal/ShellState.mm @@ -78,7 +78,7 @@ - (id)initWithFrame:(NSRect)frameRect nativeFSManager:(nc::utility::NativeFSMana }); ParserImpl::Params parser_params; - parser_params.error_log = [](std::string_view _error) { Log::Error(SPDLOC, "parsing error: {}", _error); }; + parser_params.error_log = [](std::string_view _error) { Log::Error("parsing error: {}", _error); }; m_Parser = std::make_unique(parser_params); m_Interpreter = std::make_unique(m_TermScrollView.screen); @@ -398,7 +398,7 @@ - (void)dumpRawInputIfRequired:(std::span)_bytes dispatch_assert_background_queue(); if( Log::Level() <= spdlog::level::trace ) { auto input = term::input::FormatRawInput(_bytes); - dispatch_to_main_queue([input = std::move(input)] { Log::Trace(SPDLOC, "raw input: {}", input); }); + dispatch_to_main_queue([input = std::move(input)] { Log::Trace("raw input: {}", input); }); } // std::cerr << term::input::FormatRawInput(_bytes) << std::endl; } diff --git a/Source/Panel/source/CursorBackup.mm b/Source/Panel/source/CursorBackup.mm index 32062982d..4e5130469 100644 --- a/Source/Panel/source/CursorBackup.mm +++ b/Source/Panel/source/CursorBackup.mm @@ -7,7 +7,7 @@ CursorBackup::CursorBackup(int _current_cursor_pos, const data::Model &_data) noexcept : m_Data(_data) { - Log::Trace(SPDLOC, "Saving cursor position: {}", _current_cursor_pos); + Log::Trace("Saving cursor position: {}", _current_cursor_pos); if( _current_cursor_pos >= 0 ) { assert(_current_cursor_pos < _data.SortedEntriesCount()); auto item = _data.EntryAtSortPosition(_current_cursor_pos); @@ -20,7 +20,7 @@ int CursorBackup::RestoredCursorPosition() const noexcept { const int restored_pos = FindRestoredCursorPosition(); - Log::Trace(SPDLOC, "Restored cursor position: {}", restored_pos); + Log::Trace("Restored cursor position: {}", restored_pos); return restored_pos; } diff --git a/Source/Panel/source/PanelData.mm b/Source/Panel/source/PanelData.mm index 9621a8168..e5a526dbd 100644 --- a/Source/Panel/source/PanelData.mm +++ b/Source/Panel/source/PanelData.mm @@ -108,8 +108,7 @@ static void InitVolatileDataWithListing(std::vector &_vd, cons if( !_listing ) throw std::logic_error("PanelData::Load: listing can't be nullptr"); - Log::Info(SPDLOC, - "Loading {} listing, {} entries, {}", + Log::Info("Loading {} listing, {} entries, {}", magic_enum::enum_name(_type), _listing->Count(), _listing->IsUniform() ? _listing->Directory().c_str() : "N/A"); @@ -147,8 +146,7 @@ static void UpdateWithExisingVD(ItemVolatileData &_new_vd, const ItemVolatileDat { assert(dispatch_is_main_queue()); // STA api design - Log::Info(SPDLOC, - "ReLoading listing, {} entries, {}", + Log::Info("ReLoading listing, {} entries, {}", _listing->Count(), _listing->IsUniform() ? _listing->Directory().c_str() : "N/A"); diff --git a/Source/Panel/source/PanelViewFieldEditor.mm b/Source/Panel/source/PanelViewFieldEditor.mm index a6143012a..c9e0c4a8e 100644 --- a/Source/Panel/source/PanelViewFieldEditor.mm +++ b/Source/Panel/source/PanelViewFieldEditor.mm @@ -83,10 +83,10 @@ - (void)markNextFilenamePart - (BOOL)textShouldEndEditing:(NSText *) [[maybe_unused]] textObject { if( m_Stashed ) { - Log::Trace(SPDLOC, "textShouldEndEditing called, stashed, ignoring"); + Log::Trace("textShouldEndEditing called, stashed, ignoring"); } else { - Log::Trace(SPDLOC, "textShouldEndEditing called, accepting"); + Log::Trace("textShouldEndEditing called, accepting"); [self finishEditing]; } return true; @@ -95,10 +95,10 @@ - (BOOL)textShouldEndEditing:(NSText *) [[maybe_unused]] textObject - (void)textDidEndEditing:(NSNotification *) [[maybe_unused]] notification { if( m_Stashed ) { - Log::Trace(SPDLOC, "textShouldEndEditing called, stashed, ignoring"); + Log::Trace("textShouldEndEditing called, stashed, ignoring"); } else { - Log::Trace(SPDLOC, "textShouldEndEditing called, accepting"); + Log::Trace("textShouldEndEditing called, accepting"); [self cancelEditing]; } } @@ -161,7 +161,7 @@ - (void)finishEditing - (void)cancelEditing { - Log::Trace(SPDLOC, "cancelEditing called"); + Log::Trace("cancelEditing called"); self.onTextEntered = nil; auto finish_handler = self.onEditingFinished; self.onEditingFinished = nil; @@ -177,7 +177,7 @@ - (nullable NSUndoManager *)undoManagerForTextView:(NSTextView *) [[maybe_unused - (void)viewWillMoveToWindow:(NSWindow *)_wnd { - Log::Trace(SPDLOC, "viewWillMoveToWindow: {}", (__bridge void *)_wnd); + Log::Trace("viewWillMoveToWindow: {}", (__bridge void *)_wnd); const auto notify_center = NSNotificationCenter.defaultCenter; if( self.window ) { [notify_center removeObserver:self name:NSWindowDidResignKeyNotification object:nil]; @@ -197,7 +197,7 @@ - (void)viewWillMoveToWindow:(NSWindow *)_wnd - (void)windowStatusDidChange { - Log::Trace(SPDLOC, "windowStatusDidChange called"); + Log::Trace("windowStatusDidChange called"); [self finishEditing]; } @@ -234,13 +234,13 @@ static NSRange NextFilenameSelectionRange(NSString *_string, NSRange _current_se - (void)stash { - Log::Trace(SPDLOC, "stash called"); + Log::Trace("stash called"); m_Stashed = true; } - (void)unstash { - Log::Trace(SPDLOC, "unstash called"); + Log::Trace("unstash called"); m_Stashed = false; } diff --git a/Source/RoutedIO/source/RoutedIO.cpp b/Source/RoutedIO/source/RoutedIO.cpp index 58184c407..b5038aea6 100644 --- a/Source/RoutedIO/source/RoutedIO.cpp +++ b/Source/RoutedIO/source/RoutedIO.cpp @@ -113,10 +113,10 @@ bool RoutedIO::IsHelperCurrent() bool RoutedIO::TurnOn() { - Log::Info(SPDLOC, "RoutedIO::TurnOn() called"); + Log::Info("RoutedIO::TurnOn() called"); if( m_Sandboxed ) { - Log::Error(SPDLOC, "RoutedIO::TurnOn() was called in the sandboxed process."); + Log::Error("RoutedIO::TurnOn() was called in the sandboxed process."); return false; } @@ -124,23 +124,23 @@ bool RoutedIO::TurnOn() return true; if( !IsHelperInstalled() ) { - Log::Info(SPDLOC, "The privileged helper is not installed."); + Log::Info("The privileged helper is not installed."); if( !AskToInstallHelper() ) { - Log::Error(SPDLOC, "Failed to install the privileged helper."); + Log::Error("Failed to install the privileged helper."); return false; } } if( !AuthenticateAsAdmin() ) { - Log::Error(SPDLOC, "Failed to authenticate as admin, cannot turn RoutedIO on"); + Log::Error("Failed to authenticate as admin, cannot turn RoutedIO on"); return false; } if( IsHelperCurrent() ) { - Log::Info(SPDLOC, "The installed privileged helper is the same as the bundled one."); + Log::Info("The installed privileged helper is the same as the bundled one."); } else { - Log::Warn(SPDLOC, "Detected an outdated privileged helper."); + Log::Warn("Detected an outdated privileged helper."); // we have another version of a helper app if( Connect() && IsHelperAlive() ) { // ask helper it remove itself and then to exit gracefully @@ -165,14 +165,14 @@ bool RoutedIO::TurnOn() m_Connection = nullptr; if( !AskToInstallHelper() ) { - Log::Error(SPDLOC, "Failed to install the privileged helper."); + Log::Error("Failed to install the privileged helper."); return false; } } else { // the helper is not current + we can't ask it to remove itself. protocol/signing probs? // anyway, can't go this way, no turning routing on - Log::Error(SPDLOC, "Failed to communicate with an outdated helper."); + Log::Error("Failed to communicate with an outdated helper."); return false; } } @@ -180,14 +180,14 @@ bool RoutedIO::TurnOn() if( Connect() ) m_Enabled = true; - Log::Info(SPDLOC, "RoutedIO enabled={}", m_Enabled.load()); + Log::Info("RoutedIO enabled={}", m_Enabled.load()); return m_Enabled; } void RoutedIO::TurnOff() { - Log::Info(SPDLOC, "RoutedIO::Turnoff() called"); + Log::Info("RoutedIO::Turnoff() called"); if( m_Connection ) { xpc_connection_cancel(m_Connection); @@ -197,7 +197,7 @@ void RoutedIO::TurnOff() m_Enabled = false; m_AuthenticatedAsAdmin = false; - Log::Info(SPDLOC, "RoutedIO enabled={}", m_Enabled.load()); + Log::Info("RoutedIO enabled={}", m_Enabled.load()); } bool RoutedIO::SayImAuthenticated(xpc_connection_t _connection) noexcept @@ -220,7 +220,7 @@ bool RoutedIO::SayImAuthenticated(xpc_connection_t _connection) noexcept bool RoutedIO::AskToInstallHelper() { if( m_Sandboxed ) { - Log::Error(SPDLOC, "RoutedIO::AskToInstallHelper() was called in a sandboxed process"); + Log::Error("RoutedIO::AskToInstallHelper() was called in a sandboxed process"); return false; } @@ -238,11 +238,10 @@ bool RoutedIO::AskToInstallHelper() // Obtain the right to install privileged helper tools (kSMRightBlessPrivilegedHelper). const OSStatus status = AuthorizationCreate(&auth_rights, &auth_env, flags, &auth_ref); if( status == errAuthorizationSuccess ) { - Log::Info(SPDLOC, "Successfully authenticated for SMRightBless"); + Log::Info("Successfully authenticated for SMRightBless"); } else { - Log::Error(SPDLOC, - "RoutedIO::AskToInstallHelper() failed to execute AuthorizationCreate() with " + Log::Error("RoutedIO::AskToInstallHelper() failed to execute AuthorizationCreate() with " "the error: {}.", AuthRCToString(status)); return false; @@ -254,20 +253,17 @@ bool RoutedIO::AskToInstallHelper() const bool result = SMJobBless(kSMDomainSystemLaunchd, g_HelperLabelCF, auth_ref, &error); if( result ) { - Log::Info(SPDLOC, "Successfully installed a privileged helper"); + Log::Info("Successfully installed a privileged helper"); } else if( error != nullptr ) { if( auto desc = base::CFPtr::adopt(CFErrorCopyDescription(error)) ) - Log::Error(SPDLOC, - "RoutedIO::AskToInstallHelper() SMJobBless failed with error: {}. ", + Log::Error("RoutedIO::AskToInstallHelper() SMJobBless failed with error: {}. ", base::CFStringGetUTF8StdString(desc.get())); if( auto desc = base::CFPtr::adopt(CFErrorCopyFailureReason(error)) ) - Log::Error(SPDLOC, - "RoutedIO::AskToInstallHelper() SMJobBless failed with failure reason: {}. ", + Log::Error("RoutedIO::AskToInstallHelper() SMJobBless failed with failure reason: {}. ", base::CFStringGetUTF8StdString(desc.get())); if( auto desc = base::CFPtr::adopt(CFErrorCopyRecoverySuggestion(error)) ) - Log::Error(SPDLOC, - "RoutedIO::AskToInstallHelper() SMJobBless failed with recovery suggestion: {}. ", + Log::Error("RoutedIO::AskToInstallHelper() SMJobBless failed with recovery suggestion: {}. ", base::CFStringGetUTF8StdString(desc.get())); CFRelease(error); } @@ -279,15 +275,15 @@ bool RoutedIO::AskToInstallHelper() bool RoutedIO::AuthenticateAsAdmin() { - Log::Debug(SPDLOC, "RoutedIO::AuthenticateAsAdmin() called"); + Log::Debug("RoutedIO::AuthenticateAsAdmin() called"); if( m_Sandboxed ) { - Log::Error(SPDLOC, "RoutedIO::AuthenticateAsAdmin() was called in a sandboxed process"); + Log::Error("RoutedIO::AuthenticateAsAdmin() was called in a sandboxed process"); return false; } if( m_AuthenticatedAsAdmin ) { - Log::Debug(SPDLOC, "Already authenticated"); + Log::Debug("Already authenticated"); return true; } @@ -307,12 +303,11 @@ bool RoutedIO::AuthenticateAsAdmin() const OSStatus status = AuthorizationCreate(&auth_rights, &auth_env, flags, nullptr); if( status == errAuthorizationSuccess ) { - Log::Info(SPDLOC, "Successfully authenticated as administrator"); + Log::Info("Successfully authenticated as administrator"); m_AuthenticatedAsAdmin = true; } else { - Log::Error(SPDLOC, - "RoutedIO::AuthenticateAsAdmin() failed to execute AuthorizationCreate() with " + Log::Error("RoutedIO::AuthenticateAsAdmin() failed to execute AuthorizationCreate() with " "the error: {}", AuthRCToString(status)); } @@ -326,14 +321,14 @@ bool RoutedIO::Connect() return true; if( m_AuthenticatedAsAdmin == false ) { - Log::Error(SPDLOC, "RoutedIO::Connect() was called without being authenticated as admin"); + Log::Error("RoutedIO::Connect() was called without being authenticated as admin"); return false; } xpc_connection_t connection = xpc_connection_create_mach_service(g_HelperLabel, nullptr, XPC_CONNECTION_MACH_SERVICE_PRIVILEGED); if( !connection ) { - Log::Error(SPDLOC, "RoutedIO::Connect() failed to call xpc_connection_create_mach_service()"); + Log::Error("RoutedIO::Connect() failed to call xpc_connection_create_mach_service()"); return false; } @@ -349,7 +344,7 @@ bool RoutedIO::Connect() xpc_connection_resume(connection); if( !SayImAuthenticated(connection) ) { - Log::Error(SPDLOC, "RoutedIO::Connect() failed to call SayImAuthenticated()"); + Log::Error("RoutedIO::Connect() failed to call SayImAuthenticated()"); xpc_connection_cancel(connection); return false; } diff --git a/Source/Term/source/InterpreterImpl.cpp b/Source/Term/source/InterpreterImpl.cpp index ac33fea6d..93c9139d4 100644 --- a/Source/Term/source/InterpreterImpl.cpp +++ b/Source/Term/source/InterpreterImpl.cpp @@ -130,7 +130,7 @@ void InterpreterImpl::InterpretSingleCommand(const input::Command &_command) ProcessCursorStyle(*std::get_if(&_command.payload)); break; default: - Log::Warn(SPDLOC, "Interpreter::InterpretSingleCommand: missed {}", magic_enum::enum_name(type)); + Log::Warn("Interpreter::InterpretSingleCommand: missed {}", magic_enum::enum_name(type)); break; } } diff --git a/Source/Term/source/Parser.cpp b/Source/Term/source/Parser.cpp index ff3d0b0d7..b282b7d82 100644 --- a/Source/Term/source/Parser.cpp +++ b/Source/Term/source/Parser.cpp @@ -95,7 +95,7 @@ std::string VerboseDescription(const Command &_command) void LogCommands(std::span _commands) { for( auto &cmd : _commands ) - Log::Debug(SPDLOC, "command: {}", VerboseDescription(cmd)); + Log::Debug("command: {}", VerboseDescription(cmd)); } std::string FormatRawInput(std::span _input) diff --git a/Source/Term/source/ShellTask.cpp b/Source/Term/source/ShellTask.cpp index 1a12413c0..ffcb89ec8 100644 --- a/Source/Term/source/ShellTask.cpp +++ b/Source/Term/source/ShellTask.cpp @@ -286,68 +286,68 @@ bool ShellTask::Launch(const std::filesystem::path &_work_dir) return false; I->cwd = _work_dir.generic_string(); - Log::Info(SPDLOC, "Starting a new shell: {}", I->shell_path); + Log::Info("Starting a new shell: {}", I->shell_path); if( I->shell_resolved_path != I->shell_path ) - Log::Info(SPDLOC, "{} -> {}", I->shell_path, I->shell_resolved_path); - Log::Info(SPDLOC, "Initial work directory: {}", I->cwd); + Log::Info("{} -> {}", I->shell_path, I->shell_resolved_path); + Log::Info("Initial work directory: {}", I->cwd); // remember current locale and stuff const auto env = BuildEnv(); - Log::Debug(SPDLOC, "Environment:"); + Log::Debug("Environment:"); for( auto &env_record : env ) - Log::Debug(SPDLOC, "\t{} = {}", env_record.first, env_record.second); + Log::Debug("\t{} = {}", env_record.first, env_record.second); // open a pseudo-terminal device const int openpt_rc = posix_openpt(O_RDWR); if( openpt_rc < 0 ) { - Log::Warn(SPDLOC, "posix_openpt() returned a negative value"); + Log::Warn("posix_openpt() returned a negative value"); throw std::runtime_error("posix_openpt() returned a negative value"); } - Log::Debug(SPDLOC, "posix_openpt(O_RDWR) returned {} (master_fd)", openpt_rc); + Log::Debug("posix_openpt(O_RDWR) returned {} (master_fd)", openpt_rc); I->master_fd = openpt_rc; // grant access to the slave pseudo-terminal device const int graptpt_rc = grantpt(I->master_fd); if( graptpt_rc != 0 ) { - Log::Warn(SPDLOC, "graptpt_rc() failed"); + Log::Warn("graptpt_rc() failed"); throw std::runtime_error("graptpt_rc() failed"); } // unlock a pseudo-terminal master/slave pair const int unlockpt_rc = unlockpt(I->master_fd); if( unlockpt_rc != 0 ) { - Log::Warn(SPDLOC, "unlockpt() failed"); + Log::Warn("unlockpt() failed"); throw std::runtime_error("unlockpt() failed"); } // get name of the slave pseudo-terminal device const char *const ptsname = ::ptsname(I->master_fd); if( ptsname == nullptr ) { - Log::Warn(SPDLOC, "ptsname() failed"); + Log::Warn("ptsname() failed"); throw std::runtime_error("ptsname() failed"); } - Log::Debug(SPDLOC, "ptsname: {}", ptsname); + Log::Debug("ptsname: {}", ptsname); // opening a slave fd for the pseudo-terminal const int slave_fd = open(ptsname, O_RDWR); if( openpt_rc < 0 ) { - Log::Warn(SPDLOC, "open() returned a negative value"); + Log::Warn("open() returned a negative value"); throw std::runtime_error("open() returned a negative value"); } - Log::Debug(SPDLOC, "slave_fd: {}", slave_fd); + Log::Debug("slave_fd: {}", slave_fd); // init FIFO stuff for Shell's CWD if( I->shell_type == ShellType::Bash || I->shell_type == ShellType::ZSH ) { // for Bash and ZSH use a regular pipe handle const int cwd_pipe_rc = pipe(I->cwd_pipe); if( cwd_pipe_rc != 0 ) { - Log::Warn(SPDLOC, "pipe(I->cwd_pipe) failed"); + Log::Warn("pipe(I->cwd_pipe) failed"); throw std::runtime_error("pipe(I->cwd_pipe) failed"); } const int semaphore_pipe_rc = pipe(I->semaphore_pipe); if( semaphore_pipe_rc != 0 ) { - Log::Warn(SPDLOC, "pipe(I->semaphore_pipe) failed"); + Log::Warn("pipe(I->semaphore_pipe) failed"); throw std::runtime_error("pipe(I->semaphore_pipe) failed"); } } @@ -359,42 +359,42 @@ bool ShellTask::Launch(const std::filesystem::path &_work_dir) // open the cwd channel first I->tcsh_cwd_path = dir + "nimble_commander.tcsh.cwd_pipe." + mypid + "." + gen; - Log::Debug(SPDLOC, "tcsh_cwd_path: {}", I->tcsh_cwd_path); + Log::Debug("tcsh_cwd_path: {}", I->tcsh_cwd_path); const int cwd_fifo_rc = mkfifo(I->tcsh_cwd_path.c_str(), 0600); if( cwd_fifo_rc != 0 ) { - Log::Warn(SPDLOC, "mkfifo(I->tcsh_cwd_path.c_str(), 0600) failed"); + Log::Warn("mkfifo(I->tcsh_cwd_path.c_str(), 0600) failed"); throw std::runtime_error("mkfifo(I->tcsh_cwd_path.c_str(), 0600) failed"); } const int cwd_open_rc = open(I->tcsh_cwd_path.c_str(), O_RDWR); if( cwd_open_rc < 0 ) { - Log::Warn(SPDLOC, "open(I->tcsh_cwd_path.c_str(), O_RDWR) failed"); + Log::Warn("open(I->tcsh_cwd_path.c_str(), O_RDWR) failed"); throw std::runtime_error("open(I->tcsh_cwd_path.c_str(), O_RDWR) failed"); } I->cwd_pipe[0] = cwd_open_rc; // and then open the semaphore channel I->tcsh_semaphore_path = dir + "nimble_commander.tcsh.semaphore_pipe." + mypid + "." + gen; - Log::Debug(SPDLOC, "tcsh_semaphore_path: {}", I->tcsh_semaphore_path); + Log::Debug("tcsh_semaphore_path: {}", I->tcsh_semaphore_path); const int semaphore_fifo_rc = mkfifo(I->tcsh_semaphore_path.c_str(), 0600); if( semaphore_fifo_rc != 0 ) { - Log::Warn(SPDLOC, "mkfifo(I->tcsh_semaphore_path.c_str(), 0600) failed"); + Log::Warn("mkfifo(I->tcsh_semaphore_path.c_str(), 0600) failed"); throw std::runtime_error("mkfifo(I->tcsh_semaphore_path.c_str(), 0600) failed"); } const int semaphore_open_rc = open(I->tcsh_semaphore_path.c_str(), O_RDWR); if( semaphore_open_rc < 0 ) { - Log::Warn(SPDLOC, "open(I->tcsh_semaphore_path.c_str(), O_RDWR) failed"); + Log::Warn("open(I->tcsh_semaphore_path.c_str(), O_RDWR) failed"); throw std::runtime_error("open(I->tcsh_semaphore_path.c_str(), O_RDWR) failed"); } I->semaphore_pipe[1] = semaphore_open_rc; } - Log::Debug(SPDLOC, "cwd_pipe: {}, {}", I->cwd_pipe[0], I->cwd_pipe[1]); - Log::Debug(SPDLOC, "semaphore_pipe: {}, {}", I->semaphore_pipe[0], I->semaphore_pipe[1]); + Log::Debug("cwd_pipe: {}, {}", I->cwd_pipe[0], I->cwd_pipe[1]); + Log::Debug("semaphore_pipe: {}, {}", I->semaphore_pipe[0], I->semaphore_pipe[1]); // Create the child process const auto fork_rc = fork(); @@ -404,7 +404,7 @@ bool ShellTask::Launch(const std::filesystem::path &_work_dir) return false; } else if( fork_rc > 0 ) { - Log::Debug(SPDLOC, "fork() returned {}", fork_rc); + Log::Debug("fork() returned {}", fork_rc); // master I->shell_pid = fork_rc; @@ -416,13 +416,13 @@ bool ShellTask::Launch(const std::filesystem::path &_work_dir) // wait until either the forked process becomes an expected shell or dies const bool became_shell = WaitUntilBecomes(I->shell_pid, I->shell_resolved_path.native(), 5s, 1ms); if( !became_shell ) { - Log::Warn(SPDLOC, "forked process failed to become a shell!"); + Log::Warn("forked process failed to become a shell!"); I->CleanUp(); // Well, RIP return false; } if( !fd_is_valid(I->master_fd) ) { - Log::Warn(SPDLOC, "m_MasterFD is dead!"); + Log::Warn("m_MasterFD is dead!"); I->CleanUp(); // Well, RIP return false; } @@ -451,7 +451,7 @@ bool ShellTask::Launch(const std::filesystem::path &_work_dir) const ssize_t write_res = write(I->master_fd, cmd.data(), cmd.length()); I->master_write_lock.unlock(); if( write_res != static_cast(cmd.length()) ) { - Log::Warn(SPDLOC, "failed to write histctrl cmd, errno: {} ({})", errno, strerror(errno)); + Log::Warn("failed to write histctrl cmd, errno: {} ({})", errno, strerror(errno)); I->CleanUp(); // Well, RIP return false; } @@ -459,12 +459,12 @@ bool ShellTask::Launch(const std::filesystem::path &_work_dir) // write prompt setup to the shell const std::string prompt_setup = ComposePromptCommand(); - Log::Debug(SPDLOC, "prompt_setup: {}", prompt_setup); + Log::Debug("prompt_setup: {}", prompt_setup); I->master_write_lock.lock(); const ssize_t write_res = write(I->master_fd, prompt_setup.data(), prompt_setup.size()); I->master_write_lock.unlock(); if( write_res != static_cast(prompt_setup.size()) ) { - Log::Warn(SPDLOC, "failed to write command prompt, errno: {} ({})", errno, strerror(errno)); + Log::Warn("failed to write command prompt, errno: {} ({})", errno, strerror(errno)); I->CleanUp(); // Well, RIP return false; } @@ -527,7 +527,7 @@ void ShellTask::Impl::OnMasterSourceData() { dispatch_assert_background_queue(); const size_t estimated_size = dispatch_source_get_data(master_source); - Log::Trace(SPDLOC, "OnMasterSourceData() estimated {} bytes available", estimated_size); + Log::Trace("OnMasterSourceData() estimated {} bytes available", estimated_size); if( estimated_size == 0 ) { // GCD reports dead FDs as zero available data OnShellDied(); @@ -551,7 +551,7 @@ void ShellTask::Impl::OnCwdSourceData() { dispatch_assert_background_queue(); // must be called on io_queue const size_t estimated_size = dispatch_source_get_data(master_source); - Log::Trace(SPDLOC, "OnCwdSourceData() estimated {} bytes available", estimated_size); + Log::Trace("OnCwdSourceData() estimated {} bytes available", estimated_size); if( estimated_size == 0 ) { // GCD reports dead FDs as zero available data OnShellDied(); @@ -569,14 +569,14 @@ void ShellTask::Impl::OnCwdSourceData() void ShellTask::Impl::OnMasterSourceCancellation() { dispatch_assert_background_queue(); // must be called on io_queue - Log::Trace(SPDLOC, "ShellTask::Impl::OnMasterSourceCancellation() called"); + Log::Trace("ShellTask::Impl::OnMasterSourceCancellation() called"); assert(master_fd >= 0); // shall be closed later in DoCleanUp() but must be alive by now } void ShellTask::Impl::OnCwdSourceCancellation() { dispatch_assert_background_queue(); // must be called on io_queue - Log::Trace(SPDLOC, "ShellTask::Impl::OnCwdSourceCancellation() called"); + Log::Trace("ShellTask::Impl::OnCwdSourceCancellation() called"); assert(cwd_pipe[0] >= 0); // shall be closed later in DoCleanUp() but must be alive by now } @@ -601,7 +601,7 @@ void ShellTask::Impl::ProcessPwdPrompt(const void *_d, int _sz) while( new_cwd.empty() == false && (new_cwd.back() == '\n' || new_cwd.back() == '\r') ) new_cwd.pop_back(); new_cwd = EnsureTrailingSlash(new_cwd); - Log::Info(SPDLOC, "pwd prompt from shell_pid={}: {}", shell_pid.load(), new_cwd); + Log::Info("pwd prompt from shell_pid={}: {}", shell_pid.load(), new_cwd); { const auto lock_g = std::lock_guard{lock}; diff --git a/Source/Term/tests/AtomicHolder.h b/Source/Term/tests/AtomicHolder.h index eac2d3ffd..158ea6439 100644 --- a/Source/Term/tests/AtomicHolder.h +++ b/Source/Term/tests/AtomicHolder.h @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Michael Kazakov. Subject to GNU General Public License version 3. +// Copyright (C) 2020-2024 Michael Kazakov. Subject to GNU General Public License version 3. #pragma once #include @@ -7,6 +7,7 @@ #include #include #include +#include template struct AtomicHolder { diff --git a/Source/Utility/source/FSEventsDirUpdateImpl.cpp b/Source/Utility/source/FSEventsDirUpdateImpl.cpp index 80fbe6009..9872ada61 100644 --- a/Source/Utility/source/FSEventsDirUpdateImpl.cpp +++ b/Source/Utility/source/FSEventsDirUpdateImpl.cpp @@ -21,14 +21,14 @@ static std::string GetRealPath(const char *_path_in) { int tfd = open(_path_in, O_RDONLY); if( tfd == -1 ) { - Log::Warn(SPDLOC, "GetRealPath() failed to open '{}'", _path_in); + Log::Warn("GetRealPath() failed to open '{}'", _path_in); return {}; } char path_buf[MAXPATHLEN]; int ret = fcntl(tfd, F_GETPATH, path_buf); close(tfd); if( ret == -1 ) { - Log::Warn(SPDLOC, "GetRealPath() failed to F_GETPATH of '{}', errno: {}", _path_in, errno); + Log::Warn("GetRealPath() failed to F_GETPATH of '{}', errno: {}", _path_in, errno); return {}; } @@ -84,8 +84,7 @@ void FSEventsDirUpdateImpl::FSEventsDirUpdateCallback([[maybe_unused]] ConstFSEv { // WTF this data access is not locked???? - Log::Trace(SPDLOC, - "FSEventsDirUpdate::Impl::FSEventsDirUpdateCallback for {} path(s): {}", + Log::Trace("FSEventsDirUpdate::Impl::FSEventsDirUpdateCallback for {} path(s): {}", _num, fmt::join(std::span{reinterpret_cast(_paths), _num}, ", ")); @@ -98,10 +97,10 @@ void FSEventsDirUpdateImpl::FSEventsDirUpdateCallback([[maybe_unused]] ConstFSEv FSEventStreamRef FSEventsDirUpdateImpl::CreateEventStream(const std::string &path, void *context_ptr) { - Log::Debug(SPDLOC, "CreateEventStream called for '{}'", path); + Log::Debug("CreateEventStream called for '{}'", path); auto cf_path = base::CFStringCreateWithUTF8StdString(path); if( !cf_path ) { - Log::Warn(SPDLOC, "CreateEventStream failed to create a CFStringRef for '{}'", path); + Log::Warn("CreateEventStream failed to create a CFStringRef for '{}'", path); return nullptr; } @@ -118,7 +117,7 @@ FSEventStreamRef FSEventsDirUpdateImpl::CreateEventStream(const std::string &pat g_FSEventsLatency, flags); if( stream == nullptr ) { - Log::Warn(SPDLOC, "FSEventStreamCreate failed to create a stream for '{}'", path); + Log::Warn("FSEventStreamCreate failed to create a stream for '{}'", path); } }; @@ -141,7 +140,7 @@ static void StartStream(FSEventStreamRef _stream) FSEventStreamScheduleWithRunLoop(_stream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); const bool started = FSEventStreamStart(_stream); if( !started ) { - Log::Error(SPDLOC, "FSEventStreamStart failed to start"); + Log::Error("FSEventStreamStart failed to start"); } }; @@ -171,12 +170,12 @@ uint64_t FSEventsDirUpdateImpl::AddWatchPath(const char *_path, std::functionsecond.handlers.emplace_back(ticket, std::move(_handler)); return ticket; } // create a new watch stream - Log::Trace(SPDLOC, "Creating a new watcher for '{}'", _path); + Log::Trace("Creating a new watcher for '{}'", _path); auto ep = m_Watches.emplace(dir_path, WatchData{}); assert(ep.second == true); WatchData &w = ep.first->second; diff --git a/Source/Utility/source/FSEventsFileUpdateImpl.cpp b/Source/Utility/source/FSEventsFileUpdateImpl.cpp index 778a1beff..b80e33b08 100644 --- a/Source/Utility/source/FSEventsFileUpdateImpl.cpp +++ b/Source/Utility/source/FSEventsFileUpdateImpl.cpp @@ -45,7 +45,7 @@ FSEventsFileUpdateImpl::FSEventsFileUpdateImpl() m_WeakAsyncContext = m_AsyncContext; m_KickstartQueue = dispatch_queue_create("FSEventsFileUpdateImpl", DISPATCH_QUEUE_SERIAL); - Log::Trace(SPDLOC, "FSEventsFileUpdateImpl created"); + Log::Trace("FSEventsFileUpdateImpl created"); } FSEventsFileUpdateImpl::~FSEventsFileUpdateImpl() @@ -55,7 +55,7 @@ FSEventsFileUpdateImpl::~FSEventsFileUpdateImpl() for( auto &watch : m_Watches ) { DeleteEventStream(watch.second.stream); } - Log::Trace(SPDLOC, "FSEventsFileUpdateImpl destroyed"); + Log::Trace("FSEventsFileUpdateImpl destroyed"); dispatch_release(m_KickstartQueue); } @@ -65,7 +65,7 @@ uint64_t FSEventsFileUpdateImpl::AddWatchPath(const std::filesystem::path &_path auto lock = std::lock_guard{m_Lock}; const auto token = m_NextTicket++; - Log::Debug(SPDLOC, "Adding for path: {}, token: {}", _path, token); + Log::Debug("Adding for path: {}, token: {}", _path, token); const auto was_empty = m_Watches.empty(); if( auto existing = m_Watches.find(_path); existing != m_Watches.end() ) { @@ -97,7 +97,7 @@ void FSEventsFileUpdateImpl::RemoveWatchPathWithToken(uint64_t _token) for( auto watch_it = m_Watches.begin(), watch_end = m_Watches.end(); watch_it != watch_end; ++watch_it ) { auto &watch = watch_it->second; if( watch.handlers.contains(_token) ) { - Log::Debug(SPDLOC, "Removing a watch for token {} - {}", _token, watch_it->first); + Log::Debug("Removing a watch for token {} - {}", _token, watch_it->first); watch.handlers.erase(_token); if( watch.handlers.empty() ) { DeleteEventStream(watch.stream); @@ -106,7 +106,7 @@ void FSEventsFileUpdateImpl::RemoveWatchPathWithToken(uint64_t _token) return; } } - Log::Warn(SPDLOC, "Unable to remove a watch for stray token: {}", _token); + Log::Warn("Unable to remove a watch for stray token: {}", _token); } FSEventStreamRef FSEventsFileUpdateImpl::CreateEventStream(const std::filesystem::path &_path) const @@ -134,13 +134,13 @@ FSEventStreamRef FSEventsFileUpdateImpl::CreateEventStream(const std::filesystem g_FSEventsLatency, flags); if( stream == nullptr ) { - Log::Warn(SPDLOC, "Failed to create a stream for {}", _path); + Log::Warn("Failed to create a stream for {}", _path); return; } FSEventStreamScheduleWithRunLoop(stream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); FSEventStreamStart(stream); - Log::Debug(SPDLOC, "Started a stream for {}", _path); + Log::Debug("Started a stream for {}", _path); }; if( dispatch_is_main_queue() ) @@ -179,7 +179,7 @@ void FSEventsFileUpdateImpl::Callback([[maybe_unused]] ConstFSEventStreamRef _st auto lock = std::lock_guard{m_Lock}; const auto now = base::machtime(); for( auto path : paths ) { - Log::Debug(SPDLOC, "Callback fired for {}", path); + Log::Debug("Callback fired for {}", path); auto watches_it = m_Watches.find(path); if( watches_it != m_Watches.end() ) { watches_it->second.stat = GetStat(watches_it->first); // sync I/O :`( @@ -259,7 +259,7 @@ void FSEventsFileUpdateImpl::AcceptScannedStats(const std::vectorsecond.snapshot_time = now; if( changed ) { - Log::Debug(SPDLOC, "Callback fired for {}", _paths[i]); + Log::Debug("Callback fired for {}", _paths[i]); for( auto &handler : it->second.handlers ) { // NB! no copy here => this call is NOT reenterant! handler.second(); @@ -291,7 +291,7 @@ void FSEventsFileUpdateImpl::BackgroundScanner(std::vector> stats; stats.reserve(_paths.size()); diff --git a/Source/Utility/source/FunctionKeysPass.mm b/Source/Utility/source/FunctionKeysPass.mm index edcfc4398..a32768c20 100644 --- a/Source/Utility/source/FunctionKeysPass.mm +++ b/Source/Utility/source/FunctionKeysPass.mm @@ -83,7 +83,7 @@ static CGEventRef NewFnButtonPress(CGKeyCode _vk, bool _key_down, CGEventFlags _ const auto is_key_down = _type == kCGEventKeyDown; const auto keycode = static_cast(CGEventGetIntegerValueField(_event, kCGKeyboardEventKeycode)); const auto substitute = [&](CGKeyCode _vk) { return NewFnButtonPress(_vk, is_key_down, CGEventGetFlags(_event)); }; - Log::Trace(SPDLOC, "HandleRegularKeyEvents: keycode is {}, pressed={}", keycode, is_key_down); + Log::Trace("HandleRegularKeyEvents: keycode is {}, pressed={}", keycode, is_key_down); switch( keycode ) { case 145: return substitute(kVK_F1); @@ -133,7 +133,7 @@ static CGEventRef NewFnButtonPress(CGKeyCode _vk, bool _key_down, CGEventFlags _ const auto substitute = [&](CGKeyCode _vk) { return NewFnButtonPress(_vk, is_key_down, static_cast(ev.modifierFlags)); }; - Log::Trace(SPDLOC, "HandleControlButtons: keycode is {}, pressed={}", keycode, is_key_down); + Log::Trace("HandleControlButtons: keycode is {}, pressed={}", keycode, is_key_down); switch( keycode ) { case NX_KEYTYPE_BRIGHTNESS_DOWN: return substitute(kVK_F1); diff --git a/Source/Utility/source/NativeFSManagerImpl.mm b/Source/Utility/source/NativeFSManagerImpl.mm index 912cd0e4a..b99e7f569 100644 --- a/Source/Utility/source/NativeFSManagerImpl.mm +++ b/Source/Utility/source/NativeFSManagerImpl.mm @@ -50,11 +50,11 @@ - (void)volumeDidUnmount:(NSNotification *)_notification; NativeFSManagerImpl::NativeFSManagerImpl() { - Log::Debug(SPDLOC, "Started initializing NativeFSManagerImpl {}", static_cast(this)); + Log::Debug("Started initializing NativeFSManagerImpl {}", static_cast(this)); // it takes ~150ms, so this delay can be shaved off by running it async auto apfstree_promise = std::async(std::launch::async, [] { return FetchAPFSTree(); }); - Log::Trace(SPDLOC, "Gathering info about all native filesystems {}", static_cast(this)); + Log::Trace("Gathering info about all native filesystems {}", static_cast(this)); for( const auto &mount_path : GetFullFSList() ) { const auto volume = std::make_shared(); volume->mounted_at_path = mount_path; @@ -64,10 +64,10 @@ - (void)volumeDidUnmount:(NSNotification *)_notification; m_VolumeLookup.Insert(volume, EnsureTrailingSlash(mount_path)); } - Log::Trace(SPDLOC, "Getting APFSTree {}", static_cast(this)); + Log::Trace("Getting APFSTree {}", static_cast(this)); m_StartupAPFSTree = apfstree_promise.get(); - Log::Trace(SPDLOC, "Getting firmlinks {}", static_cast(this)); + Log::Trace("Getting firmlinks {}", static_cast(this)); m_RootFirmlinks = FetchFirmlinks(); if( m_StartupAPFSTree ) @@ -76,7 +76,7 @@ - (void)volumeDidUnmount:(NSNotification *)_notification; SubscribeToWorkspaceNotifications(); - Log::Debug(SPDLOC, "Finished initializing NativeFSManagerImpl {}", static_cast(this)); + Log::Debug("Finished initializing NativeFSManagerImpl {}", static_cast(this)); } NativeFSManagerImpl::~NativeFSManagerImpl() @@ -138,27 +138,27 @@ - (void)volumeDidUnmount:(NSNotification *)_notification; static void GetAllInfos(NativeFileSystemInfo &_volume) { - Log::Info(SPDLOC, "Gatherning info about {}", _volume.mounted_at_path); + Log::Info("Gatherning info about {}", _volume.mounted_at_path); if( !GetBasicInfo(_volume) ) - Log::Error(SPDLOC, "failed to GetBasicInfo() on the volume {}", _volume.mounted_at_path); + Log::Error("failed to GetBasicInfo() on the volume {}", _volume.mounted_at_path); if( !GetFormatInfo(_volume) ) - Log::Error(SPDLOC, "failed to GetFormatInfo() on the volume {}", _volume.mounted_at_path); + Log::Error("failed to GetFormatInfo() on the volume {}", _volume.mounted_at_path); if( !GetInterfacesInfo(_volume) ) - Log::Error(SPDLOC, "failed to GetInterfacesInfo() on the volume {}", _volume.mounted_at_path); + Log::Error("failed to GetInterfacesInfo() on the volume {}", _volume.mounted_at_path); if( !GetVerboseInfo(_volume) ) - Log::Error(SPDLOC, "failed to GetVerboseInfo() on the volume {}", _volume.mounted_at_path); + Log::Error("failed to GetVerboseInfo() on the volume {}", _volume.mounted_at_path); if( !UpdateSpaceInfo(_volume) ) - Log::Error(SPDLOC, "failed to UpdateSpaceInfo() on the volume {}", _volume.mounted_at_path); + Log::Error("failed to UpdateSpaceInfo() on the volume {}", _volume.mounted_at_path); } static bool GetBasicInfo(NativeFileSystemInfo &_volume) { - Log::Trace(SPDLOC, "Getting basic info about {}", _volume.mounted_at_path); + Log::Trace("Getting basic info about {}", _volume.mounted_at_path); struct statfs stat; @@ -211,7 +211,7 @@ static bool GetBasicInfo(NativeFileSystemInfo &_volume) static bool GetFormatInfo(NativeFileSystemInfo &_v) { - Log::Trace(SPDLOC, "Getting format info about {}", _v.mounted_at_path); + Log::Trace("Getting format info about {}", _v.mounted_at_path); struct { u_int32_t attr_length; @@ -258,7 +258,7 @@ static bool GetFormatInfo(NativeFileSystemInfo &_v) static bool GetInterfacesInfo(NativeFileSystemInfo &_v) { - Log::Trace(SPDLOC, "Getting interface info about {}", _v.mounted_at_path); + Log::Trace("Getting interface info about {}", _v.mounted_at_path); struct { u_int32_t attr_length; vol_capabilities_attr_t c; @@ -297,7 +297,7 @@ static bool GetInterfacesInfo(NativeFileSystemInfo &_v) static bool GetVerboseInfo(NativeFileSystemInfo &_volume) { - Log::Trace(SPDLOC, "Getting verbose info about {}", _volume.mounted_at_path); + Log::Trace("Getting verbose info about {}", _volume.mounted_at_path); NSString *path_str = [NSString stringWithUTF8String:_volume.mounted_at_path.c_str()]; if( path_str == nil ) diff --git a/Source/Utility/source/URLSecurityScopedResourceGuard.mm b/Source/Utility/source/URLSecurityScopedResourceGuard.mm index d1d4c70fa..140767804 100644 --- a/Source/Utility/source/URLSecurityScopedResourceGuard.mm +++ b/Source/Utility/source/URLSecurityScopedResourceGuard.mm @@ -8,7 +8,7 @@ { for( NSURL *url in _urls ) { if( [url startAccessingSecurityScopedResource] ) { - Log::Trace(SPDLOC, "Started accessing a security scoped resource: {}", url.fileSystemRepresentation); + Log::Trace("Started accessing a security scoped resource: {}", url.fileSystemRepresentation); m_URLs.emplace_back(url); } else { @@ -24,7 +24,7 @@ { for( NSURL *url : m_URLs ) { [url stopAccessingSecurityScopedResource]; - Log::Trace(SPDLOC, "Stopped accessing a security scoped resource: {}", url.fileSystemRepresentation); + Log::Trace("Stopped accessing a security scoped resource: {}", url.fileSystemRepresentation); } } diff --git a/Source/VFS/include/VFS/VFSConfiguration.h b/Source/VFS/include/VFS/VFSConfiguration.h index 6668f389a..04e0b51e1 100644 --- a/Source/VFS/include/VFS/VFSConfiguration.h +++ b/Source/VFS/include/VFS/VFSConfiguration.h @@ -1,8 +1,9 @@ -// Copyright (C) 2015-2021 Michael Kazakov. Subject to GNU General Public License version 3. +// Copyright (C) 2015-2024 Michael Kazakov. Subject to GNU General Public License version 3. #pragma once #include +#include /** * Configuration requirements synopsis diff --git a/Source/VFS/source/ArcLARaw/Host.cpp b/Source/VFS/source/ArcLARaw/Host.cpp index ffd2eecee..9faec9fc9 100644 --- a/Source/VFS/source/ArcLARaw/Host.cpp +++ b/Source/VFS/source/ArcLARaw/Host.cpp @@ -193,8 +193,7 @@ void ArchiveRawHost::Init(const VFSCancelChecker &_cancel_checker) const auto &path = Configuration().Get().path; auto extracted = read_stream(g_MaxBytes, path, *Parent(), _cancel_checker); if( extracted.vfs_err != VFSError::Ok ) { - Log::Warn(SPDLOC, - "unable to open {}({}), error: {}({})", + Log::Warn("unable to open {}({}), error: {}({})", path.c_str(), Parent()->Tag(), VFSError::FormatErrorCode(extracted.vfs_err), diff --git a/Source/VFS/source/NetDropbox/Authenticator.mm b/Source/VFS/source/NetDropbox/Authenticator.mm index e2f9f2876..8704ab1cb 100644 --- a/Source/VFS/source/NetDropbox/Authenticator.mm +++ b/Source/VFS/source/NetDropbox/Authenticator.mm @@ -75,7 +75,7 @@ void PerformRequest(const Request &_request, auto state = [OIDAuthState authStateByPresentingAuthorizationRequest:request callback:callback]; #pragma clang diagnostic pop m_RedirectHTTPHandler.currentAuthorizationFlow = state; - Log::Info(SPDLOC, "Started OAuth2 authentication process."); + Log::Info("Started OAuth2 authentication process."); } void AuthenticatorImpl::Callback(OIDAuthState *_Nullable _auth_state, NSError *_Nullable _error) @@ -95,8 +95,7 @@ void PerformRequest(const Request &_request, if( auto account_id = objc_cast(_auth_state.lastTokenResponse.additionalParameters[@"account_id"]) ) token.account_id = account_id.UTF8String; - Log::Info(SPDLOC, - "Successfully got auth token, type={}, scope={}, account_id={}, len(token)={}, " + Log::Info("Successfully got auth token, type={}, scope={}, account_id={}, len(token)={}, " "len(refresh_token)={}.", token.token_type, token.scope, @@ -107,7 +106,7 @@ void PerformRequest(const Request &_request, return; } if( _error != nil ) { - Log::Warn(SPDLOC, "Failed to got auth token, error: {}", _error.localizedDescription.UTF8String); + Log::Warn("Failed to got auth token, error: {}", _error.localizedDescription.UTF8String); int error = VFSError::Ok; if( [_error.domain isEqualToString:OIDOAuthTokenErrorDomain] || diff --git a/Source/VFS/source/NetDropbox/Aux.mm b/Source/VFS/source/NetDropbox/Aux.mm index 29922e644..49862721b 100644 --- a/Source/VFS/source/NetDropbox/Aux.mm +++ b/Source/VFS/source/NetDropbox/Aux.mm @@ -136,7 +136,7 @@ int VFSErrorFromErrorAndReponseAndData(NSError *_error, NSURLResponse *_response { assert(_session != nil); assert(_request != nil); - Log::Debug(SPDLOC, "Sending infinite sync request at {}", _request.URL.absoluteString.UTF8String); + Log::Debug("Sending infinite sync request at {}", _request.URL.absoluteString.UTF8String); dispatch_semaphore_t sem = dispatch_semaphore_create(0); __block NSData *data = nil; __block NSURLResponse *response = nil; @@ -172,7 +172,7 @@ int VFSErrorFromErrorAndReponseAndData(NSError *_error, NSURLResponse *_response if( !_cancel_checker ) return SendInfiniteSynchronousRequest(_session, _request); - Log::Debug(SPDLOC, "Sending finite sync request at {}", _request.URL.absoluteString.UTF8String); + Log::Debug("Sending finite sync request at {}", _request.URL.absoluteString.UTF8String); const auto timeout = 100 * NSEC_PER_MSEC; // wake up every 100ms dispatch_semaphore_t sem = dispatch_semaphore_create(0); __block NSData *data = nil; diff --git a/Source/VFS/source/NetDropbox/Host.mm b/Source/VFS/source/NetDropbox/Host.mm index 3179102ca..abdc902bc 100644 --- a/Source/VFS/source/NetDropbox/Host.mm +++ b/Source/VFS/source/NetDropbox/Host.mm @@ -529,15 +529,15 @@ static VFSNetDropboxHostConfiguration Compose(const std::string &_account, return {_1st_errc, _1st_data}; if( _1st_errc == VFSError::FromErrno(EAUTH) && !I->m_RefreshToken.empty() ) { - Log::Info(SPDLOC, "Got 401 - trying to refresh an access token"); + Log::Info("Got 401 - trying to refresh an access token"); // Handle HTTP 401 - try to regen our short-lived access token if possible const auto [refresh_errc, access_token] = RetreiveAccessTokenFromRefreshToken(I->m_RefreshToken); if( refresh_errc != VFSError::Ok ) { - Log::Warn(SPDLOC, "Failed to refresn an access token"); + Log::Warn("Failed to refresn an access token"); // failed to refresh - give up return {_1st_errc, _1st_data}; } - Log::Info(SPDLOC, "Successfully refreshed an access token"); + Log::Info("Successfully refreshed an access token"); SetAccessToken(access_token); } else { diff --git a/Source/VFS/source/NetFTP/Cache.cpp b/Source/VFS/source/NetFTP/Cache.cpp index 20b38e0b0..b8a3e6455 100644 --- a/Source/VFS/source/NetFTP/Cache.cpp +++ b/Source/VFS/source/NetFTP/Cache.cpp @@ -62,7 +62,7 @@ std::shared_ptr Cache::FindDirectoryInt(std::string_view _path) const void Cache::InsertLISTDirectory(const char *_path, std::shared_ptr _directory) { - Log::Trace(SPDLOC, "Cache::InsertLISTDirectory({}) called", _path); + Log::Trace("Cache::InsertLISTDirectory({}) called", _path); // TODO: also update ->parent_dir here @@ -86,7 +86,7 @@ void Cache::InsertLISTDirectory(const char *_path, std::shared_ptr _d void Cache::CommitNewFile(const std::string &_path) { - Log::Trace(SPDLOC, "Cache::CommitNewFile({}) called", _path); + Log::Trace("Cache::CommitNewFile({}) called", _path); std::filesystem::path p = _path; assert(p.is_absolute()); @@ -117,7 +117,7 @@ void Cache::CommitNewFile(const std::string &_path) void Cache::MakeEntryDirty(const std::string &_path) { - Log::Trace(SPDLOC, "Cache::MakeEntryDirty({}) called", _path); + Log::Trace("Cache::MakeEntryDirty({}) called", _path); std::filesystem::path p = _path; assert(p.is_absolute()); @@ -138,7 +138,7 @@ void Cache::MakeEntryDirty(const std::string &_path) void Cache::CommitRMD(const std::string &_path) { - Log::Trace(SPDLOC, "Cache::CommitRMD({}) called", _path); + Log::Trace("Cache::CommitRMD({}) called", _path); std::lock_guard lock(m_CacheLock); EraseEntryInt(_path); @@ -153,14 +153,14 @@ void Cache::CommitRMD(const std::string &_path) void Cache::CommitUnlink(const std::string &_path) { - Log::Trace(SPDLOC, "Cache::CommitUnlink({}) called", _path); + Log::Trace("Cache::CommitUnlink({}) called", _path); std::lock_guard lock(m_CacheLock); EraseEntryInt(_path); } void Cache::CommitMKD(const std::string &_path) { - Log::Trace(SPDLOC, "Cache::CommitMKD({}) called", _path); + Log::Trace("Cache::CommitMKD({}) called", _path); std::filesystem::path p = _path; assert(p.is_absolute()); @@ -184,7 +184,7 @@ void Cache::CommitMKD(const std::string &_path) void Cache::CommitRename(const std::string &_old_path, const std::string &_new_path) { - Log::Trace(SPDLOC, "Cache::CommitRename({}, {}) called", _old_path, _new_path); + Log::Trace("Cache::CommitRename({}, {}) called", _old_path, _new_path); std::filesystem::path old_path = _old_path, new_path = _new_path; assert(old_path.is_absolute() && new_path.is_absolute()); @@ -256,7 +256,7 @@ void Cache::CommitRename(const std::string &_old_path, const std::string &_new_p void Cache::EraseEntryInt(const std::string &_path) { - Log::Trace(SPDLOC, "Cache::EraseEntryInt({}) called", _path); + Log::Trace("Cache::EraseEntryInt({}) called", _path); std::filesystem::path p = _path; assert(p.filename() != ""); // _path with no trailing slashes assert(p.is_absolute()); diff --git a/Source/VFS/source/NetFTP/File.cpp b/Source/VFS/source/NetFTP/File.cpp index a60fabc0c..dd10f0ec9 100644 --- a/Source/VFS/source/NetFTP/File.cpp +++ b/Source/VFS/source/NetFTP/File.cpp @@ -11,12 +11,12 @@ namespace nc::vfs::ftp { File::File(const char *_relative_path, std::shared_ptr _host) : VFSFile(_relative_path, _host) { - Log::Trace(SPDLOC, "File::File({}, {}) called", _relative_path, static_cast(_host.get())); + Log::Trace("File::File({}, {}) called", _relative_path, static_cast(_host.get())); } File::~File() { - Log::Trace(SPDLOC, "File::~File() called"); + Log::Trace("File::~File() called"); Close(); } @@ -27,7 +27,7 @@ bool File::IsOpened() const int File::Close() { - Log::Trace(SPDLOC, "File::Close() called"); + Log::Trace("File::Close() called"); if( m_CURL && m_Mode == Mode::Write ) { // if we're still writing - finish it and tell cache about changes @@ -61,11 +61,11 @@ std::filesystem::path File::DirName() const int File::Open(unsigned long _open_flags, const VFSCancelChecker &_cancel_checker) { - Log::Trace(SPDLOC, "File::Open({}) called", _open_flags); + Log::Trace("File::Open({}) called", _open_flags); auto ftp_host = std::dynamic_pointer_cast(Host()); VFSStat stat; const int stat_ret = ftp_host->Stat(Path(), stat, 0, _cancel_checker); - Log::Trace(SPDLOC, "stat_ret = {}", stat_ret); + Log::Trace("stat_ret = {}", stat_ret); if( stat_ret == 0 && ((stat.mode & S_IFMT) == S_IFREG) && (_open_flags & VFSFlags::OF_Read) != 0 && (_open_flags & VFSFlags::OF_Write) == 0 ) { @@ -122,7 +122,7 @@ int File::Open(unsigned long _open_flags, const VFSCancelChecker &_cancel_checke ssize_t File::ReadChunk(void *_read_to, uint64_t _read_size, uint64_t _file_offset, VFSCancelChecker _cancel_checker) { - Log::Trace(SPDLOC, "File::ReadChunk({}, {}, {}) called", _read_to, _read_size, _file_offset); + Log::Trace("File::ReadChunk({}, {}, {}) called", _read_to, _read_size, _file_offset); // TODO: mutex lock bool error = false; @@ -176,7 +176,7 @@ ssize_t File::ReadChunk(void *_read_to, uint64_t _read_size, uint64_t _file_offs mc = curl_multi_wait(m_CURL->curlm, nullptr, 0, m_SelectTimeout.tv_usec, nullptr); } if( mc != CURLM_OK ) { - Log::Error(SPDLOC, "curl_multi failed, code {}.", std::to_underlying(mc)); + Log::Error("curl_multi failed, code {}.", std::to_underlying(mc)); error = true; break; } @@ -195,7 +195,7 @@ ssize_t File::ReadChunk(void *_read_to, uint64_t _read_size, uint64_t _file_offs while( msgs_left ) { CURLMsg *msg = curl_multi_info_read(m_CURL->curlm, &msgs_left); if( msg == nullptr || msg->msg != CURLMSG_DONE || msg->data.result != CURLE_OK ) { - Log::Error(SPDLOC, "curl_multi_info_read() returned {}.", std::to_underlying(msg->msg)); + Log::Error("curl_multi_info_read() returned {}.", std::to_underlying(msg->msg)); error = true; } } @@ -227,7 +227,7 @@ ssize_t File::ReadChunk(void *_read_to, uint64_t _read_size, uint64_t _file_offs ssize_t File::Read(void *_buf, size_t _size) { - Log::Trace(SPDLOC, "File::Read({}, {}) called", _buf, _size); + Log::Trace("File::Read({}, {}) called", _buf, _size); if( Eof() ) return 0; @@ -241,7 +241,7 @@ ssize_t File::Read(void *_buf, size_t _size) ssize_t File::Write(const void *_buf, size_t _size) { - Log::Trace(SPDLOC, "File::Write({}, {}) called", _buf, _size); + Log::Trace("File::Write({}, {}) called", _buf, _size); // TODO: reconnecting support if( !IsOpened() ) @@ -260,7 +260,7 @@ ssize_t File::Write(const void *_buf, size_t _size) mc = curl_multi_wait(m_CURL->curlm, nullptr, 0, m_SelectTimeout.tv_usec, nullptr); } if( mc != CURLM_OK ) { - Log::Error(SPDLOC, "curl_multi failed, code {}.", std::to_underlying(mc)); + Log::Error("curl_multi failed, code {}.", std::to_underlying(mc)); break; } } while( still_running && !m_WriteBuf.Exhausted() ); @@ -271,7 +271,7 @@ ssize_t File::Write(const void *_buf, size_t _size) while( msgs_left ) { CURLMsg *msg = curl_multi_info_read(m_CURL->curlm, &msgs_left); if( msg == nullptr || msg->msg != CURLMSG_DONE || msg->data.result != CURLE_OK ) { - Log::Error(SPDLOC, "curl_multi_info_read() returned {}.", std::to_underlying(msg->msg)); + Log::Error("curl_multi_info_read() returned {}.", std::to_underlying(msg->msg)); error = true; } } @@ -309,7 +309,7 @@ ssize_t File::Size() const bool File::Eof() const { - Log::Trace(SPDLOC, "File::Eof() called"); + Log::Trace("File::Eof() called"); if( !IsOpened() ) return true; return m_FilePos >= m_FileSize; @@ -317,7 +317,7 @@ bool File::Eof() const off_t File::Seek(off_t _off, int _basis) { - Log::Trace(SPDLOC, "File::Seek({}, {}) called", _off, _basis); + Log::Trace("File::Seek({}, {}) called", _off, _basis); if( !IsOpened() ) return VFSError::InvalidCall; @@ -347,7 +347,7 @@ off_t File::Seek(off_t _off, int _basis) void File::FinishWriting() { - Log::Trace(SPDLOC, "File::FinishWriting() called"); + Log::Trace("File::FinishWriting() called"); assert(m_Mode == Mode::Write); int still_running = 0; @@ -357,7 +357,7 @@ void File::FinishWriting() mc = curl_multi_wait(m_CURL->curlm, nullptr, 0, m_SelectTimeout.tv_usec, nullptr); } if( mc != CURLM_OK ) { - Log::Error(SPDLOC, "curl_multi failed, code {}.", std::to_underlying(mc)); + Log::Error("curl_multi failed, code {}.", std::to_underlying(mc)); break; } } while( still_running ); @@ -365,7 +365,7 @@ void File::FinishWriting() void File::FinishReading() { - Log::Trace(SPDLOC, "File::FinishReading() called"); + Log::Trace("File::FinishReading() called"); assert(m_Mode == Mode::Read); // tell curl to cancel any going reading if any diff --git a/Source/VFS/source/NetFTP/Host.cpp b/Source/VFS/source/NetFTP/Host.cpp index f47b5ee6a..a4c7b2eb9 100644 --- a/Source/VFS/source/NetFTP/Host.cpp +++ b/Source/VFS/source/NetFTP/Host.cpp @@ -128,7 +128,7 @@ int FTPHost::DownloadAndCacheListing(CURLInstance *_inst, std::shared_ptr *_cached_dir, const VFSCancelChecker &_cancel_checker) { - Log::Trace(SPDLOC, "FTPHost::DownloadAndCacheListing({}, {}) called", static_cast(_inst), _path); + Log::Trace("FTPHost::DownloadAndCacheListing({}, {}) called", static_cast(_inst), _path); if( _inst == nullptr || _path == nullptr ) return VFSError::InvalidCall; @@ -153,7 +153,7 @@ int FTPHost::DownloadListing(CURLInstance *_inst, std::string &_buffer, const VFSCancelChecker &_cancel_checker) { - Log::Trace(SPDLOC, "FTPHost::DownloadListing({}, {}) called", static_cast(_inst), _path); + Log::Trace("FTPHost::DownloadListing({}, {}) called", static_cast(_inst), _path); if( _path == nullptr || _path[0] != '/' ) return VFSError::InvalidCall; @@ -162,7 +162,7 @@ int FTPHost::DownloadListing(CURLInstance *_inst, path += '/'; const std::string request = BuildFullURLString(path.c_str()); - Log::Trace(SPDLOC, "Request: {}", request); + Log::Trace("Request: {}", request); std::string response; _inst->call_lock.lock(); @@ -180,12 +180,12 @@ int FTPHost::DownloadListing(CURLInstance *_inst, _inst->EasyClearProgFunc(); _inst->call_lock.unlock(); - Log::Trace(SPDLOC, "CURLcode = {}", std::to_underlying(result)); + Log::Trace("CURLcode = {}", std::to_underlying(result)); if( result != 0 ) return CURLErrorToVFSError(result); - Log::Trace(SPDLOC, "response = {}", response); + Log::Trace("response = {}", response); _buffer.swap(response); return 0; @@ -222,9 +222,9 @@ std::unique_ptr FTPHost::SpawnCURL() int FTPHost::Stat(const char *_path, VFSStat &_st, unsigned long _flags, const VFSCancelChecker &_cancel_checker) { - Log::Trace(SPDLOC, "FTPHost::Stat({}, {}) called", _path, _flags); + Log::Trace("FTPHost::Stat({}, {}) called", _path, _flags); if( _path == nullptr || _path[0] != '/' ) { - Log::Warn(SPDLOC, "Invalid call"); + Log::Warn("Invalid call"); return VFSError::InvalidCall; } @@ -248,10 +248,10 @@ int FTPHost::Stat(const char *_path, VFSStat &_st, unsigned long _flags, const V // try to find dir from cache if( !(_flags & VFSFlags::F_ForceRefresh) ) { if( auto dir = m_Cache->FindDirectory(parent_dir.native()) ) { - Log::Trace(SPDLOC, "found a cached directory '{}', outdated={}", parent_dir.native(), dir->IsOutdated()); + Log::Trace("found a cached directory '{}', outdated={}", parent_dir.native(), dir->IsOutdated()); auto entry = dir->EntryByName(filename); if( entry ) { - Log::Trace(SPDLOC, "found an entry for '{}', outdated={}", filename, entry->dirty); + Log::Trace("found an entry for '{}', outdated={}", filename, entry->dirty); if( !entry->dirty ) { // if entry is here and it's not outdated - return it entry->ToStat(_st); return 0; @@ -259,7 +259,7 @@ int FTPHost::Stat(const char *_path, VFSStat &_st, unsigned long _flags, const V // if entry is here and it is outdated - we have to fetch a new listing } else { - Log::Trace(SPDLOC, "didn't find an entry for '{}'", filename); + Log::Trace("didn't find an entry for '{}'", filename); if( !dir->IsOutdated() ) { // if we can't find entry and dir is not outdated - return NotFound. return VFSError::NotFound; } diff --git a/Source/VFS/source/NetFTP/Host.h b/Source/VFS/source/NetFTP/Host.h index 7fc9cd683..5cc2408c4 100644 --- a/Source/VFS/source/NetFTP/Host.h +++ b/Source/VFS/source/NetFTP/Host.h @@ -5,6 +5,7 @@ #include #include #include +#include // RTFM: http://www.ietf.org/rfc/rfc959.txt diff --git a/Source/VFS/source/NetFTP/Internals.cpp b/Source/VFS/source/NetFTP/Internals.cpp index a6e1838f7..5425f1f58 100644 --- a/Source/VFS/source/NetFTP/Internals.cpp +++ b/Source/VFS/source/NetFTP/Internals.cpp @@ -9,7 +9,7 @@ namespace nc::vfs::ftp { size_t CURLWriteDataIntoString(void *buffer, size_t size, size_t nmemb, void *userp) { - Log::Trace(SPDLOC, "CURLWriteDataIntoString({}, {}, {}, {}) called", buffer, size, nmemb, userp); + Log::Trace("CURLWriteDataIntoString({}, {}, {}, {}) called", buffer, size, nmemb, userp); auto sz = size * nmemb; char *tmp = static_cast(alloca(sz + 1)); memcpy(tmp, buffer, sz); @@ -218,7 +218,7 @@ CURLInstance::~CURLInstance() CURLcode CURLInstance::PerformEasy() { - Log::Trace(SPDLOC, "CURLInstance::PerformEasy() called"); + Log::Trace("CURLInstance::PerformEasy() called"); assert(!IsAttached()); return curl_easy_perform(curl); } @@ -233,7 +233,7 @@ CURLcode CURLInstance::PerformMulti() mc = curl_multi_wait(curlm, nullptr, 0, 10000, nullptr); } if( mc != CURLM_OK ) { - Log::Error(SPDLOC, "curl_multi failed, code {}", std::to_underlying(mc)); + Log::Error("curl_multi failed, code {}", std::to_underlying(mc)); break; } } while( still_running ); @@ -318,7 +318,7 @@ size_t ReadBuffer::Write(const void *_src, size_t _size, size_t _nmemb, void *_t size_t ReadBuffer::DoWrite(const void *_src, size_t _size, size_t _nmemb) { - Log::Trace(SPDLOC, "ReadBuffer::Write({}, {}, {}) called", _src, _size, _nmemb); + Log::Trace("ReadBuffer::Write({}, {}, {}) called", _src, _size, _nmemb); const size_t bytes = _size * _nmemb; m_Buf.insert(m_Buf.end(), static_cast(_src), static_cast(_src) + bytes); @@ -328,14 +328,14 @@ size_t ReadBuffer::DoWrite(const void *_src, size_t _size, size_t _nmemb) void ReadBuffer::Discard(size_t _sz) { - Log::Trace(SPDLOC, "ReadBuffer::Discard({}) called", _sz); + Log::Trace("ReadBuffer::Discard({}) called", _sz); assert(_sz <= m_Buf.size()); m_Buf.erase(m_Buf.begin(), std::next(m_Buf.begin(), _sz)); } void WriteBuffer::Write(const void *_mem, size_t _size) { - Log::Trace(SPDLOC, "WriteBuffer::Write({}, {}) called", _mem, _size); + Log::Trace("WriteBuffer::Write({}, {}) called", _mem, _size); m_Buf.insert(m_Buf.end(), static_cast(_mem), static_cast(_mem) + _size); } @@ -347,20 +347,20 @@ size_t WriteBuffer::Read(void *ptr, size_t size, size_t nmemb, void *_this) size_t WriteBuffer::DoRead(void *_dest, size_t _size, size_t _nmemb) { - Log::Trace(SPDLOC, "WriteBuffer::DoRead({}, {}, {}) called", _dest, _size, _nmemb); + Log::Trace("WriteBuffer::DoRead({}, {}, {}) called", _dest, _size, _nmemb); assert(m_Consumed <= m_Buf.size()); const size_t feed = std::min(_size * _nmemb, m_Buf.size() - m_Consumed); std::memcpy(_dest, m_Buf.data() + m_Consumed, feed); m_Consumed += feed; assert(m_Consumed <= m_Buf.size()); - Log::Trace(SPDLOC, "WriteBuffer: fed {} bytes", feed); + Log::Trace("WriteBuffer: fed {} bytes", feed); return feed; } void WriteBuffer::DiscardConsumed() noexcept { - Log::Trace(SPDLOC, "WriteBuffer::DiscardConsumed() called, m_Consumed={}", m_Consumed); + Log::Trace("WriteBuffer::DiscardConsumed() called, m_Consumed={}", m_Consumed); assert(m_Consumed <= m_Buf.size()); m_Buf.erase(m_Buf.begin(), std::next(m_Buf.begin(), m_Consumed)); m_Consumed = 0; diff --git a/Source/VFS/source/VFSError.mm b/Source/VFS/source/VFSError.mm index 190781279..762316170 100644 --- a/Source/VFS/source/VFSError.mm +++ b/Source/VFS/source/VFSError.mm @@ -162,7 +162,7 @@ int FromErrno(int _errno) noexcept return _errno + g_PosixBase; } else { - nc::vfs::Log::Warn(SPDLOC, "VFSError::FromErrno(): unknown errno - {}", _errno); + nc::vfs::Log::Warn("VFSError::FromErrno(): unknown errno - {}", _errno); return FromErrno(EINVAL); } } diff --git a/Source/VFSIcon/source/IconBuilderImpl.mm b/Source/VFSIcon/source/IconBuilderImpl.mm index 01c36688e..0c8758cf2 100644 --- a/Source/VFSIcon/source/IconBuilderImpl.mm +++ b/Source/VFSIcon/source/IconBuilderImpl.mm @@ -26,12 +26,11 @@ IconBuilder::LookupResult IconBuilderImpl::LookupExistingIcon(const VFSListingItem &_item, int _icon_px_size) { if( bool(_item) == false || _icon_px_size <= 0 ) { - Log::Warn(SPDLOC, "LookupExistingIcon(): invalid lookup request"); + Log::Warn("LookupExistingIcon(): invalid lookup request"); return {}; } - Log::Trace(SPDLOC, - "LookupExistingIcon(): looking up at '{}' for '{}', vfs: '{}'", + Log::Trace("LookupExistingIcon(): looking up at '{}' for '{}', vfs: '{}'", _item.Directory(), _item.Filename(), _item.Host()->JunctionPath()); @@ -43,13 +42,13 @@ result.thumbnail = m_QLThumbnailsCache->ThumbnailIfHas(path, _icon_px_size); if( result.thumbnail ) { - Log::Debug(SPDLOC, "got a thumbnail for '{}'", path); + Log::Debug("got a thumbnail for '{}'", path); return result; } result.filetype = m_WorkspaceIconsCache->IconIfHas(path); if( result.filetype ) { - Log::Debug(SPDLOC, "got a workspace icon for '{}'", path); + Log::Debug("got a workspace icon for '{}'", path); return result; } } @@ -71,12 +70,12 @@ if( _item.HasExtension() ) { result.filetype = m_ExtensionIconsCache->IconForExtension(_item.Extension()); if( result.filetype ) { - Log::Debug(SPDLOC, "got a filetype icon for '{}'", _item.Filename()); + Log::Debug("got a filetype icon for '{}'", _item.Filename()); return result; } } - Log::Debug(SPDLOC, "have only a generic icon for '{}'", _item.Filename()); + Log::Debug("have only a generic icon for '{}'", _item.Filename()); result.generic = GetGenericIcon(_item); return result; } @@ -85,12 +84,11 @@ IconBuilderImpl::BuildRealIcon(const VFSListingItem &_item, int _icon_px_size, const CancelChecker &_cancel_checker) { if( bool(_item) == false || _icon_px_size <= 0 ) { - Log::Warn(SPDLOC, "BuildRealIcon(): invalid lookup request"); + Log::Warn("BuildRealIcon(): invalid lookup request"); return {}; } - Log::Trace(SPDLOC, - "BuildRealIcon(): building for at '{}' for '{}', vfs: '{}'", + Log::Trace("BuildRealIcon(): building for at '{}' for '{}', vfs: '{}'", _item.Directory(), _item.Filename(), _item.Host()->JunctionPath()); @@ -106,17 +104,17 @@ // 1st - try to built a real thumbnail if( ShouldTryProducingQLThumbnailOnNativeFS(_item) ) { - Log::Debug(SPDLOC, "BuildRealIcon(): building a QL thumbnail for '{}'", _item.Filename()); + Log::Debug("BuildRealIcon(): building a QL thumbnail for '{}'", _item.Filename()); auto file_hint = QLThumbnailsCache::FileStateHint{}; file_hint.size = _item.Size(); file_hint.mtime = _item.MTime(); result.thumbnail = m_QLThumbnailsCache->ProduceThumbnail(path, _icon_px_size, file_hint); if( result.thumbnail ) { - Log::Debug(SPDLOC, "BuildRealIcon(): got a QL thumbnail for '{}'", _item.Filename()); + Log::Debug("BuildRealIcon(): got a QL thumbnail for '{}'", _item.Filename()); return result; } else { - Log::Warn(SPDLOC, "BuildRealIcon(): failed to get a QL thumbnail for '{}'", _item.Filename()); + Log::Warn("BuildRealIcon(): failed to get a QL thumbnail for '{}'", _item.Filename()); } } @@ -125,8 +123,7 @@ // 2nd - if we haven't built a real thumbnail - try an extension instead result.filetype = m_WorkspaceIconsCache->ProduceIcon(path); - Log::Debug(SPDLOC, - "BuildRealIcon(): got a workspace icon for '{}' = {}", + Log::Debug("BuildRealIcon(): got a workspace icon for '{}' = {}", _item.Filename(), objc_bridge_cast(result.filetype)); return result; diff --git a/Source/VFSIcon/source/IconRepositoryImplBase.mm b/Source/VFSIcon/source/IconRepositoryImplBase.mm index 96f8d7e51..96cdba140 100644 --- a/Source/VFSIcon/source/IconRepositoryImplBase.mm +++ b/Source/VFSIcon/source/IconRepositoryImplBase.mm @@ -58,9 +58,9 @@ try { _client_block(); } catch( std::exception &ex ) { - Log::Error(SPDLOC, "RunBlock(): exception caught: '{}'({})", ex.what(), typeid(ex).name()); + Log::Error("RunBlock(): exception caught: '{}'({})", ex.what(), typeid(ex).name()); } catch( ... ) { - Log::Error(SPDLOC, "RunBlock(): unknown exception caught"); + Log::Error("RunBlock(): unknown exception caught"); } auto lock = std::lock_guard{m_AwaitingLock}; diff --git a/Source/VFSIcon/source/QLThumbnailsCacheImpl.mm b/Source/VFSIcon/source/QLThumbnailsCacheImpl.mm index ea74a6b75..d78e8999b 100644 --- a/Source/VFSIcon/source/QLThumbnailsCacheImpl.mm +++ b/Source/VFSIcon/source/QLThumbnailsCacheImpl.mm @@ -108,11 +108,11 @@ static inline void hash_combine(size_t &seed, const T &v, Rest... rest) static NSImage *BuildRep(const std::string &_filename, int _px_size) { - Log::Info(SPDLOC, "BuildRep(): building QL tumbnail for '{}' ({}px)", _filename, _px_size); + Log::Info("BuildRep(): building QL tumbnail for '{}' ({}px)", _filename, _px_size); CFURLRef url = CFURLCreateFromFileSystemRepresentation( nullptr, reinterpret_cast(_filename.c_str()), _filename.length(), false); if( !url ) { - Log::Warn(SPDLOC, "BuildRep(): failed to create NSURL for '{}'", _filename); + Log::Warn("BuildRep(): failed to create NSURL for '{}'", _filename); return nil; } @@ -123,7 +123,7 @@ static inline void hash_combine(size_t &seed, const T &v, Rest... rest) CGImageRelease(thumbnail); } else { - Log::Warn(SPDLOC, "BuildRep(): failed to build a thumbnail image for '{}'", _filename); + Log::Warn("BuildRep(): failed to build a thumbnail image for '{}'", _filename); } CFRelease(url); return result; @@ -146,11 +146,11 @@ static inline void hash_combine(size_t &seed, const T &v, Rest... rest) NSImage * QLThumbnailsCacheImpl::Produce(const std::string &_filename, int _px_size, const std::optional &_hint) { - Log::Info(SPDLOC, "Produce(): request for '{}' ({}px)", _filename, _px_size); + Log::Info("Produce(): request for '{}' ({}px)", _filename, _px_size); const auto temp_key = Key{std::string_view{_filename}, _px_size, Key::no_ownership}; auto lock = std::unique_lock{m_ItemsLock}; if( m_Items.count(temp_key) ) { // O(1) - Log::Debug(SPDLOC, "found a cached item for '{}' ({}px)", _filename, _px_size); + Log::Debug("found a cached item for '{}' ({}px)", _filename, _px_size); auto info = m_Items[temp_key]; // acquiring a copy of intrusive_ptr **by*value**! O(1) lock.unlock(); assert(info != nullptr); @@ -158,8 +158,7 @@ static inline void hash_combine(size_t &seed, const T &v, Rest... rest) return info->image; } else { - Log::Debug(SPDLOC, - "didn't find a cached item for '{}' ({}px). Adding new item, current cache size = {}", + Log::Debug("didn't find a cached item for '{}' ({}px). Adding new item, current cache size = {}", _filename, _px_size, m_Items.size()); @@ -177,10 +176,10 @@ static inline void hash_combine(size_t &seed, const T &v, Rest... rest) static std::optional ReadFileState(const std::string &_file_path) { - Log::Trace(SPDLOC, "ReadFileState(): requested a state for '{}'", _file_path); + Log::Trace("ReadFileState(): requested a state for '{}'", _file_path); struct stat st; if( stat(_file_path.c_str(), &st) != 0 ) { - Log::Warn(SPDLOC, "ReadFileState(): failed to stat() at '{}'", _file_path); + Log::Warn("ReadFileState(): failed to stat() at '{}'", _file_path); return std::nullopt; // for some reason the file is not accessible - can't do anything } QLThumbnailsCache::FileStateHint hint; @@ -194,20 +193,20 @@ static inline void hash_combine(size_t &seed, const T &v, Rest... rest) Info &_info, const std::optional &_hint) { - Log::Trace(SPDLOC, "CheckCacheAndUpdateIfNeeded(): called for '{}' ({}px)", _filename, _px_size); + Log::Trace("CheckCacheAndUpdateIfNeeded(): called for '{}' ({}px)", _filename, _px_size); if( _info.is_in_work.test_and_set() == false ) { auto clear_lock = at_scope_end([&] { _info.is_in_work.clear(); }); // we're first to take control of this item const auto file_state_hint = _hint ? _hint : ReadFileState(_filename); if( file_state_hint.has_value() == false ) { - Log::Warn(SPDLOC, "CheckCacheAndUpdateIfNeeded(): can't get a file state hint for '{}'", _filename); + Log::Warn("CheckCacheAndUpdateIfNeeded(): can't get a file state hint for '{}'", _filename); return; // can't proceed without information about the file. } // check if cache is up-to-date if( _info.file_size == file_state_hint->size && _info.mtime == file_state_hint->mtime ) { - Log::Trace(SPDLOC, "CheckCacheAndUpdateIfNeeded(): up-to-date for '{}'", _filename); + Log::Trace("CheckCacheAndUpdateIfNeeded(): up-to-date for '{}'", _filename); return; // is up-to-date => nothing to do } @@ -217,29 +216,29 @@ static inline void hash_combine(size_t &seed, const T &v, Rest... rest) // we prefer to keep the previous version of a thumbnail in case if QL can't produce a new // version for the changed file. if( auto new_image = BuildRep(_filename, _px_size) ) { - Log::Info(SPDLOC, "CheckCacheAndUpdateIfNeeded(): update the image for '{}'", _filename); + Log::Info("CheckCacheAndUpdateIfNeeded(): update the image for '{}'", _filename); _info.image = new_image; } else { - Log::Warn(SPDLOC, "CheckCacheAndUpdateIfNeeded(): failed to update the image for '{}'", _filename); + Log::Warn("CheckCacheAndUpdateIfNeeded(): failed to update the image for '{}'", _filename); } } else { // the item is currently in updating state, let's use the current image - Log::Trace(SPDLOC, "CheckCacheAndUpdateIfNeeded(): already updating now"); + Log::Trace("CheckCacheAndUpdateIfNeeded(): already updating now"); } } void QLThumbnailsCacheImpl::ProduceNew(const std::string &_filename, int _px_size, Info &_info) { - Log::Trace(SPDLOC, "ProduceNew(): called for '{}' ({}px)", _filename, _px_size); + Log::Trace("ProduceNew(): called for '{}' ({}px)", _filename, _px_size); assert(_info.is_in_work.test_and_set() == true); // _info should be locked initially auto clear_lock = at_scope_end([&] { _info.is_in_work.clear(); }); // file must exist and be accessible struct stat st; if( stat(_filename.c_str(), &st) != 0 ) { - Log::Warn(SPDLOC, "ProduceNew(): failed to stat() at '{}", _filename); + Log::Warn("ProduceNew(): failed to stat() at '{}", _filename); return; } @@ -250,17 +249,17 @@ static inline void hash_combine(size_t &seed, const T &v, Rest... rest) NSImage *QLThumbnailsCacheImpl::ThumbnailIfHas(const std::string &_filename, int _px_size) { - Log::Trace(SPDLOC, "ThumbnailIfHas(): called for '{}' ({}px)", _filename, _px_size); + Log::Trace("ThumbnailIfHas(): called for '{}' ({}px)", _filename, _px_size); const auto temp_key = Key{std::string_view{_filename}, _px_size, Key::no_ownership}; auto lock = std::lock_guard{m_ItemsLock}; if( m_Items.count(temp_key) != 0 ) { // O(1) - Log::Trace(SPDLOC, "ThumbnailIfHas(): found a cached entry for '{}' ({}px)", _filename, _px_size); + Log::Trace("ThumbnailIfHas(): found a cached entry for '{}' ({}px)", _filename, _px_size); auto &info = m_Items[temp_key]; // O(1) assert(info != nullptr); return info->image; } else { - Log::Trace(SPDLOC, "ThumbnailIfHas(): doesn't have a cached entry for '{}' ({}px)", _filename, _px_size); + Log::Trace("ThumbnailIfHas(): doesn't have a cached entry for '{}' ({}px)", _filename, _px_size); return nil; } } diff --git a/Source/VFSIcon/source/WorkspaceExtensionIconsCacheImpl.mm b/Source/VFSIcon/source/WorkspaceExtensionIconsCacheImpl.mm index 3cbd215f5..ceaf77d5d 100644 --- a/Source/VFSIcon/source/WorkspaceExtensionIconsCacheImpl.mm +++ b/Source/VFSIcon/source/WorkspaceExtensionIconsCacheImpl.mm @@ -40,7 +40,7 @@ NSImage *WorkspaceExtensionIconsCacheImpl::IconForExtension(const std::string &_extension) { - Log::Trace(SPDLOC, "IconForExtension() called for '{}'", _extension); + Log::Trace("IconForExtension() called for '{}'", _extension); if( _extension.empty() ) return nil; @@ -48,30 +48,30 @@ { const auto lock = std::lock_guard{m_Lock}; if( auto i = m_Icons.find(_extension); i != m_Icons.end() ) { - Log::Trace(SPDLOC, "IconForExtension() found a cached icon for '{}'", _extension); + Log::Trace("IconForExtension() found a cached icon for '{}'", _extension); return i->second; } } const auto uti = m_UTIDB.UTIForExtension(_extension); - Log::Info(SPDLOC, "IconForExtension() uti for '{}' is '{}'", _extension, uti); + Log::Info("IconForExtension() uti for '{}' is '{}'", _extension, uti); if( not m_UTIDB.IsDynamicUTI(uti) ) { - Log::Info(SPDLOC, "IconForExtension() getting an icon for filetype: '{}'", _extension); + Log::Info("IconForExtension() getting an icon for filetype: '{}'", _extension); NSImage *image = nil; if( @available(macOS 11.0, *) ) { - Log::Debug(SPDLOC, "IconForExtension() polling [NSWorkspace iconForContentType:'{}']", uti); + Log::Debug("IconForExtension() polling [NSWorkspace iconForContentType:'{}']", uti); UTType *uttype = [UTType typeWithIdentifier:[NSString stringWithUTF8StdString:uti]]; image = [NSWorkspace.sharedWorkspace iconForContentType:uttype]; } else { - Log::Debug(SPDLOC, "IconForExtension() polling [NSWorkspace iconForFileType:'{}']", uti); + Log::Debug("IconForExtension() polling [NSWorkspace iconForFileType:'{}']", uti); image = [NSWorkspace.sharedWorkspace iconForFileType:[NSString stringWithUTF8StdString:uti]]; } Commit_Locked(_extension, image); return image; } else { - Log::Info(SPDLOC, "IconForExtension() '{}' has dynamic uti, placing nil", _extension); + Log::Info("IconForExtension() '{}' has dynamic uti, placing nil", _extension); Commit_Locked(_extension, nil); return nil; } @@ -79,13 +79,13 @@ NSImage *WorkspaceExtensionIconsCacheImpl::GenericFileIcon() const { - Log::Trace(SPDLOC, "GenericFileIcon() called"); + Log::Trace("GenericFileIcon() called"); return m_GenericFileIcon; } NSImage *WorkspaceExtensionIconsCacheImpl::GenericFolderIcon() const { - Log::Trace(SPDLOC, "GenericFolderIcon() called"); + Log::Trace("GenericFolderIcon() called"); return m_GenericFolderIcon; } diff --git a/Source/VFSIcon/source/WorkspaceIconsCacheImpl.mm b/Source/VFSIcon/source/WorkspaceIconsCacheImpl.mm index 4cb75cbbd..6329483b5 100644 --- a/Source/VFSIcon/source/WorkspaceIconsCacheImpl.mm +++ b/Source/VFSIcon/source/WorkspaceIconsCacheImpl.mm @@ -17,34 +17,34 @@ NSImage *WorkspaceIconsCacheImpl::IconIfHas(const std::string &_file_path) { - Log::Trace(SPDLOC, "IconIfHas() called for '{}'", _file_path); + Log::Trace("IconIfHas() called for '{}'", _file_path); auto lock = std::lock_guard{m_ItemsLock}; if( m_Items.count(_file_path) != 0 ) { // O(1) auto &info = m_Items[_file_path]; // O(1) assert(info != nullptr); - Log::Trace(SPDLOC, "found, image={}", objc_bridge_cast(info->image)); + Log::Trace("found, image={}", objc_bridge_cast(info->image)); return info->image; } - Log::Trace(SPDLOC, "wasn't found"); + Log::Trace("wasn't found"); return nil; } NSImage *WorkspaceIconsCacheImpl::ProduceIcon(const std::string &_file_path) { - Log::Trace(SPDLOC, "ProduceIcon() called for '{}'", _file_path); + Log::Trace("ProduceIcon() called for '{}'", _file_path); auto lock = std::unique_lock{m_ItemsLock}; if( m_Items.count(_file_path) ) { // O(1) auto info = m_Items[_file_path]; // acquiring a copy of intrusive_ptr **by*value**! O(1) lock.unlock(); assert(info != nullptr); - Log::Trace(SPDLOC, "found, image={}", objc_bridge_cast(info->image)); + Log::Trace("found, image={}", objc_bridge_cast(info->image)); UpdateIfNeeded(_file_path, *info); return info->image; } else { // insert dummy info into the structure, so no one else can try producing it // concurrently - prohibit wasting of resources - Log::Trace(SPDLOC, "wasn't found"); + Log::Trace("wasn't found"); auto info = base::intrusive_ptr{new Info}; info->is_in_work.test_and_set(); m_Items.insert(_file_path, info); // O(1) @@ -70,7 +70,7 @@ return; // is up-to-date => nothing to do } - Log::Trace(SPDLOC, "not up-to-date, updating: '{}'", _file_path); + Log::Trace("not up-to-date, updating: '{}'", _file_path); _info.file_size = file_state_hint->size; _info.mtime = file_state_hint->mtime; @@ -82,12 +82,12 @@ _info.image = new_image; } else { - Log::Warn(SPDLOC, "failed to build at icon for '{}'", _file_path); + Log::Warn("failed to build at icon for '{}'", _file_path); } } else { // the item is currently in updating state, let's use the current image - Log::Trace(SPDLOC, "currently already updating, skip: '{}'", _file_path); + Log::Trace("currently already updating, skip: '{}'", _file_path); } } @@ -99,7 +99,7 @@ // file must exist and be accessible const auto file_state_hint = m_FileStateReader.ReadState(_file_path); if( file_state_hint.has_value() == false ) { - Log::Warn(SPDLOC, "failed to get a file state hint for '{}'", _file_path); + Log::Warn("failed to get a file state hint for '{}'", _file_path); return; } @@ -109,7 +109,7 @@ _info.image = m_IconBuilder.Build(_file_path); // img may be nil - it's ok if( _info.image == nil ) { - Log::Warn(SPDLOC, "failed to build at icon for '{}'", _file_path); + Log::Warn("failed to build at icon for '{}'", _file_path); } } diff --git a/Source/Viewer/source/Highlighting/Client.cpp b/Source/Viewer/source/Highlighting/Client.cpp index d9298890b..a8c4cb71a 100644 --- a/Source/Viewer/source/Highlighting/Client.cpp +++ b/Source/Viewer/source/Highlighting/Client.cpp @@ -12,11 +12,11 @@ static constexpr auto g_ServiceName = "com.magnumbytes.NimbleCommander.Highlight std::expected, std::string> Client::Highlight(std::string_view _text, std::string_view _settings) { - Log::Trace(SPDLOC, "Client::Highlight called"); + Log::Trace("Client::Highlight called"); xpc_connection_t connection = xpc_connection_create(g_ServiceName, nullptr); if( connection == nullptr ) { - Log::Error(SPDLOC, "Failed to create an XPC connection"); + Log::Error("Failed to create an XPC connection"); return std::unexpected("Failed to create an XPC connection"); } auto release_connection = at_scope_end([&] { xpc_release(connection); }); @@ -25,13 +25,13 @@ std::expected, std::string> Client::Highlight(std::string_vie const xpc_type_t type = xpc_get_type(_event); if( type == XPC_TYPE_ERROR ) { if( _event == XPC_ERROR_CONNECTION_INTERRUPTED ) { - Log::Error(SPDLOC, "XPC connection interrupted"); + Log::Error("XPC connection interrupted"); } else if( _event == XPC_ERROR_CONNECTION_INVALID ) { - Log::Error(SPDLOC, "XPC connection invalid"); + Log::Error("XPC connection invalid"); } else { - Log::Error(SPDLOC, "XPC unknown error"); + Log::Error("XPC unknown error"); } } }); @@ -45,41 +45,41 @@ std::expected, std::string> Client::Highlight(std::string_vie xpc_object_t reply = xpc_connection_send_message_with_reply_sync(connection, message); auto release_reply = at_scope_end([&] { xpc_release(reply); }); - Log::Trace(SPDLOC, "Got a response from the XPC service"); + Log::Trace("Got a response from the XPC service"); const xpc_type_t reply_type = xpc_get_type(reply); if( reply_type == XPC_TYPE_ERROR ) { if( reply == XPC_ERROR_CONNECTION_INTERRUPTED ) { - Log::Error(SPDLOC, "XPC connection interrupted"); + Log::Error("XPC connection interrupted"); return std::unexpected("XPC connection interrupted"); } else if( reply == XPC_ERROR_CONNECTION_INVALID ) { - Log::Error(SPDLOC, "XPC connection invalid"); + Log::Error("XPC connection invalid"); return std::unexpected("XPC connection invalid"); } else { - Log::Error(SPDLOC, "XPC unknown error"); + Log::Error("XPC unknown error"); return std::unexpected("XPC unknown error"); } } if( reply_type != XPC_TYPE_DICTIONARY ) { - Log::Error(SPDLOC, "XPC reply is not a dictionary"); + Log::Error("XPC reply is not a dictionary"); return std::unexpected("XPC reply is not a dictionary"); } if( const char *error_str = xpc_dictionary_get_string(reply, "error") ) { - Log::Error(SPDLOC, "Error while highlighting: {}", error_str); + Log::Error("Error while highlighting: {}", error_str); return std::unexpected(error_str); } size_t styles_size = 0; const void *styles = xpc_dictionary_get_data(reply, "response", &styles_size); if( !styles ) { - Log::Error(SPDLOC, "The reply doesn't contain a 'response' field"); + Log::Error("The reply doesn't contain a 'response' field"); return std::unexpected("The reply doesn't contain a 'response' field"); } - Log::Info(SPDLOC, "Got styles from the XPC service, {}b long", styles_size); + Log::Info("Got styles from the XPC service, {}b long", styles_size); std::vector