Changeset 1790
- Timestamp:
- 03/08/2007 00:29:31 (5 years ago)
- Location:
- box/chris/general
- Files:
-
- 14 edited
-
bin/bbackupctl/bbackupctl.cpp (modified) (12 diffs)
-
bin/bbackupquery/BackupQueries.cpp (modified) (54 diffs)
-
bin/bbackupquery/bbackupquery.cpp (modified) (8 diffs)
-
bin/bbstoreaccounts/bbstoreaccounts.cpp (modified) (20 diffs)
-
lib/backupclient/BackupClientRestore.cpp (modified) (1 diff)
-
lib/backupstore/BackupStoreCheck.cpp (modified) (23 diffs)
-
lib/backupstore/BackupStoreCheck2.cpp (modified) (9 diffs)
-
lib/common/DebugMemLeakFinder.cpp (modified) (1 diff)
-
lib/common/Logging.cpp (modified) (2 diffs)
-
lib/crypto/Random.cpp (modified) (1 diff)
-
lib/raidfile/RaidFileController.cpp (modified) (1 diff)
-
lib/server/SSLLib.cpp (modified) (1 diff)
-
test/bbackupd/testfiles/extcheck1.pl.in (modified) (1 diff)
-
test/bbackupd/testfiles/extcheck2.pl.in (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
box/chris/general/bin/bbackupctl/bbackupctl.cpp
r1784 r1790 110 110 111 111 // Read in the configuration file 112 if(!quiet) printf("Using configuration file %s\n", 113 configFilename.c_str()); 112 if(!quiet) BOX_NOTICE("Using configuration file " << configFilename); 114 113 115 114 std::string errs; … … 120 119 if(config.get() == 0 || !errs.empty()) 121 120 { 122 printf("Invalid configuration file:\n%s", errs.c_str());121 BOX_ERROR("Invalid configuration file: " << errs); 123 122 return 1; 124 123 } … … 129 128 if(!conf.KeyExists("CommandSocket")) 130 129 { 131 printf("Daemon isn't using a control socket, "130 BOX_ERROR("Daemon isn't using a control socket, " 132 131 "could not execute command.\n" 133 132 "Add a CommandSocket declaration to the " 134 "bbackupd.conf file. \n");133 "bbackupd.conf file."); 135 134 return 1; 136 135 } … … 154 153 catch(...) 155 154 { 156 printf("Failed to connect to daemon control socket.\n"155 BOX_ERROR("Failed to connect to daemon control socket.\n" 157 156 "Possible causes:\n" 158 157 " * Daemon not running\n" 159 158 " * Daemon busy syncing with store server\n" 160 159 " * Another bbackupctl process is communicating with the daemon\n" 161 " * Daemon is waiting to recover from an error \n"160 " * Daemon is waiting to recover from an error" 162 161 ); 163 164 #if defined WIN32 && ! defined NDEBUG165 BOX_ERROR("Failed to connect to the command socket");166 #endif167 162 168 163 return 1; … … 194 189 &updateStoreInterval, &minimumFileAge, &maxUploadWait) != 4) 195 190 { 196 printf("Config summary didn't decode\n");191 BOX_ERROR("Config summary didn't decode."); 197 192 return 1; 198 193 } … … 200 195 if(!quiet) 201 196 { 202 printf("Daemon configuration summary:\n"203 " AutomaticBackup = %s\n"204 " UpdateStoreInterval = %d seconds\n"205 " MinimumFileAge = %d seconds\n"206 " MaxUploadWait = %d seconds\n",207 autoBackup?"true":"false", updateStoreInterval,208 minimumFileAge, maxUploadWait);197 BOX_INFO("Daemon configuration summary:\n" 198 " AutomaticBackup = " << 199 (autoBackup?"true":"false") << "\n" 200 " UpdateStoreInterval = " << updateStoreInterval << 201 " seconds\n" 202 " MinimumFileAge = " << minimumFileAge << " seconds\n" 203 " MaxUploadWait = " << maxUploadWait << " seconds\n"); 209 204 } 210 205 … … 267 262 if (currentState != 0) 268 263 { 269 printf("Waiting for current sync/error state "270 "to finish... \n");264 BOX_INFO("Waiting for current sync/error state " 265 "to finish..."); 271 266 } 272 267 } … … 311 306 if(line == "start-sync") 312 307 { 313 if (!quiet) printf("Sync started...\n");308 if (!quiet) BOX_INFO("Sync started..."); 314 309 syncIsRunning = true; 315 310 } … … 318 313 if (syncIsRunning) 319 314 { 320 if (!quiet) printf("Sync finished.\n");315 if (!quiet) BOX_INFO("Sync finished.\n"); 321 316 // Send a quit command to finish nicely 322 317 connection.Write("quit\n", 5); … … 327 322 else 328 323 { 329 if (!quiet) printf("Previous sync finished.\n");324 if (!quiet) BOX_INFO("Previous sync finished."); 330 325 } 331 326 // daemon must still be busy … … 341 336 if(!quiet) 342 337 { 343 printf("Succeeded.\n");338 BOX_INFO("Succeeded.\n"); 344 339 } 345 340 finished = true; … … 347 342 else if(line == "error") 348 343 { 349 printf("ERROR. (Check command spelling)\n");344 BOX_ERROR("Check command spelling"); 350 345 returnCode = 1; 351 346 finished = true; -
box/chris/general/bin/bbackupquery/BackupQueries.cpp
r1784 r1790 182 182 GetConsoleCP())) 183 183 { 184 printf("Failed to convert encoding");184 BOX_ERROR("Failed to convert encoding"); 185 185 return; 186 186 } … … 256 256 if(alias[a] == 0) 257 257 { 258 printf("Unrecognised command: %s\n",Command);258 BOX_ERROR("Unrecognised command: " << Command); 259 259 return; 260 260 } … … 276 276 if(::strchr(commands[cmd].opts, *c) == NULL) 277 277 { 278 printf("Invalid option '%c' for command %s\n",279 *c,commands[cmd].name);278 BOX_ERROR("Invalid option '" << *c << "' for " 279 "command " << commands[cmd].name); 280 280 return; 281 281 } … … 306 306 { 307 307 // Simple implementation, so do it here 308 printf("%s (%08llx)\n", 309 GetCurrentDirectoryName().c_str(), 310 (long long)GetCurrentDirectoryID()); 308 BOX_INFO(GetCurrentDirectoryName() << " (" << 309 BOX_FORMAT_OBJECTID(GetCurrentDirectoryID())); 311 310 } 312 311 break; … … 321 320 322 321 case COMMAND_sh: 323 printf("The command to run must be specified as an argument.\n");322 BOX_ERROR("The command to run must be specified as an argument."); 324 323 break; 325 324 … … 402 401 if(rootDir == 0) 403 402 { 404 printf("Directory '%s' not found on store\n",405 args[0].c_str());403 BOX_ERROR("Directory '" << args[0] << "' not found " 404 "on store."); 406 405 return; 407 406 } … … 748 747 if(args.size() != 1 || args[0].size() == 0) 749 748 { 750 printf("Incorrect usage.\ncd [-o] [-d] <directory>\n");749 BOX_ERROR("Incorrect usage. cd [-o] [-d] <directory>"); 751 750 return; 752 751 } … … 765 764 if(id == 0) 766 765 { 767 printf("Directory '%s' not found\n", args[0].c_str());766 BOX_ERROR("Directory '" << args[0] << "' not found."); 768 767 return; 769 768 } … … 786 785 if(args.size() != 1 || args[0].size() == 0) 787 786 { 788 printf("Incorrect usage.\nlcd <local-directory>\n");787 BOX_ERROR("Incorrect usage. lcd <local-directory>"); 789 788 SetReturnCode(COMMAND_RETURN_ERROR); 790 789 return; … … 796 795 if(!ConvertConsoleToUtf8(args[0].c_str(), dirName)) 797 796 { 798 printf("Failed to convert path from console encoding.\n");797 BOX_ERROR("Failed to convert path from console encoding."); 799 798 SetReturnCode(COMMAND_RETURN_ERROR); 800 799 return; … … 806 805 if(result != 0) 807 806 { 808 printf((errno == ENOENT || errno == ENOTDIR)?"Directory '%s' does not exist\n":"Error changing dir to '%s'\n", 809 args[0].c_str()); 807 if(errno == ENOENT || errno == ENOTDIR) 808 { 809 BOX_ERROR("Directory '" << args[0] << "' does not exist."); 810 } 811 else 812 { 813 BOX_ERROR("Error changing to directory '" << 814 args[0] << ": " << strerror(errno)); 815 } 816 810 817 SetReturnCode(COMMAND_RETURN_ERROR); 811 818 return; … … 816 823 if(::getcwd(wd, PATH_MAX) == 0) 817 824 { 818 printf("Error getting current directory\n"); 825 BOX_ERROR("Error getting current directory: " << 826 strerror(errno)); 819 827 SetReturnCode(COMMAND_RETURN_ERROR); 820 828 return; … … 824 832 if(!ConvertUtf8ToConsole(wd, dirName)) 825 833 { 826 printf("Failed to convert new path from console encoding.\n");834 BOX_ERROR("Failed to convert new path from console encoding."); 827 835 SetReturnCode(COMMAND_RETURN_ERROR); 828 836 return; 829 837 } 830 printf("Local current directory is now '%s'\n", dirName.c_str());838 BOX_INFO("Local current directory is now '" << dirName << "'."); 831 839 #else 832 printf("Local current directory is now '%s'\n", wd);840 BOX_INFO("Local current directory is now '" << wd << "'."); 833 841 #endif 834 842 } … … 848 856 if(args.size() != 2) 849 857 { 850 printf("Incorrect usage.\ngetobject <object-id> <local-filename>\n"); 858 BOX_ERROR("Incorrect usage. getobject <object-id> " 859 "<local-filename>"); 851 860 return; 852 861 } … … 855 864 if(id == std::numeric_limits<long long>::min() || id == std::numeric_limits<long long>::max() || id == 0) 856 865 { 857 printf("Not a valid object ID (specified in hex)\n");866 BOX_ERROR("Not a valid object ID (specified in hex)."); 858 867 return; 859 868 } … … 863 872 if(::stat(args[1].c_str(), &st) == 0 || errno != ENOENT) 864 873 { 865 printf("The local file %s already exists\n", args[1].c_str());874 BOX_ERROR("The local file '" << args[1] << " already exists."); 866 875 return; 867 876 } … … 881 890 objectStream->CopyStreamTo(out); 882 891 883 printf("Object ID %08llx fetched successfully.\n", id); 892 BOX_INFO("Object ID " << BOX_FORMAT_OBJECTID(id) << 893 " fetched successfully."); 884 894 } 885 895 else 886 896 { 887 printf("Object does not exist on store.\n"); 897 BOX_ERROR("Object ID " << BOX_FORMAT_OBJECTID(id) << 898 " does not exist on store."); 888 899 ::unlink(args[1].c_str()); 889 900 } … … 892 903 { 893 904 ::unlink(args[1].c_str()); 894 printf("Error occured fetching object.\n");905 BOX_ERROR("Error occured fetching object."); 895 906 } 896 907 } … … 912 923 if(args.size() < 1 || (opts['i'] && args.size() != 2) || args.size() > 2) 913 924 { 914 printf("Incorrect usage.\n"925 BOX_ERROR("Incorrect usage.\n" 915 926 "get <remote-filename> [<local-filename>] or\n" 916 "get -i <object-id> <local-filename> \n");927 "get -i <object-id> <local-filename>"); 917 928 return; 918 929 } … … 932 943 if(!ConvertConsoleToUtf8(i->c_str(), out)) 933 944 { 934 fprintf(stderr, "failed to convert encoding\n");945 BOX_ERROR("Failed to convert encoding."); 935 946 return; 936 947 } … … 953 964 if(dirId == 0) 954 965 { 955 printf("Directory '%s' not found\n",956 dirName.c_str());966 BOX_ERROR("Directory '" << dirName << 967 "' not found."); 957 968 return; 958 969 } … … 982 993 fileId == 0) 983 994 { 984 printf("Not a valid object ID (specified in hex)\n");995 BOX_ERROR("Not a valid object ID (specified in hex)."); 985 996 return; 986 997 } … … 989 1000 if(dir.FindEntryByID(fileId) == 0) 990 1001 { 991 printf("ID '%08llx' not found in current " 1002 BOX_ERROR("File ID " << 1003 BOX_FORMAT_OBJECTID(fileId) << 1004 " not found in current " 992 1005 "directory on store.\n" 993 "(You can only download objects by ID " 994 "from the current directory.)\n", 995 fileId); 1006 "(You can only download files by ID " 1007 "from the current directory.)"); 996 1008 return; 997 1009 } … … 1008 1020 if(en == 0) 1009 1021 { 1010 printf("Filename '%s' not found in current " 1022 BOX_ERROR("Filename '" << args[0] << "' " 1023 "not found in current " 1011 1024 "directory on store.\n" 1012 1025 "(Subdirectories in path not " 1013 "searched.) \n", args[0].c_str());1026 "searched.)"); 1014 1027 return; 1015 1028 } … … 1028 1041 if(::stat(localName.c_str(), &st) == 0 || errno != ENOENT) 1029 1042 { 1030 printf("The local file %s already exists, will not"1031 " overwrite it.\n", localName.c_str());1043 BOX_ERROR("The local file " << localName << " already exists, " 1044 "will not overwrite it."); 1032 1045 SetReturnCode(COMMAND_RETURN_ERROR); 1033 1046 return; … … 1047 1060 1048 1061 // Done. 1049 printf("Object ID %08llx fetched sucessfully.\n", fileId); 1062 BOX_INFO("Object ID " << BOX_FORMAT_OBJECTID(fileId) << 1063 " fetched successfully."); 1050 1064 } 1051 1065 catch (BoxException &e) … … 1161 1175 else 1162 1176 { 1163 printf("Warning: couldn't determine the time of the last synchronisation -- checks not performed.\n"); 1177 BOX_WARNING("Failed to determine the time of the last " 1178 "synchronisation -- checks not performed."); 1164 1179 } 1165 1180 } … … 1168 1183 if(params.mQuickCompare) 1169 1184 { 1170 printf("WARNING: Quick compare used -- file attributes are not checked.\n"); 1185 BOX_WARNING("Quick compare used -- file attributes are not " 1186 "checked."); 1171 1187 } 1172 1188 … … 1193 1209 if(!params.mIgnoreExcludes) 1194 1210 { 1195 printf("Cannot use excludes on directory to directory comparison -- use -E flag to specify ignored excludes\n");1211 BOX_ERROR("Cannot use excludes on directory to directory comparison -- use -E flag to specify ignored excludes."); 1196 1212 return; 1197 1213 } … … 1204 1220 else 1205 1221 { 1206 printf("Incorrect usage.\ncompare -a\n or compare -l <location-name>\n or compare <store-dir-name> <local-dir-name>\n");1222 BOX_ERROR("Incorrect usage.\ncompare -a\n or compare -l <location-name>\n or compare <store-dir-name> <local-dir-name>"); 1207 1223 return; 1208 1224 } … … 1210 1226 if (!params.mQuietCompare) 1211 1227 { 1212 printf("\n[ %d (of %d) differences probably due to file "1213 "modifications after the last upload ]\n",1214 params.mDifferences ExplainedByModTime,1215 params.mDifferences);1216 } 1217 1218 printf("Differences: %d (%d dirs excluded, %d files excluded, "1219 "%d files not checked)\n",1220 params.m Differences, params.mExcludedDirs,1221 params.m ExcludedFiles, params.mUncheckedFiles);1228 BOX_INFO("[ " << 1229 params.mDifferencesExplainedByModTime << " (of " << 1230 params.mDifferences << ") differences probably " 1231 "due to file modifications after the last upload ]"); 1232 } 1233 1234 BOX_INFO("Differences: " << params.mDifferences << " (" << 1235 params.mExcludedDirs << " dirs excluded, " << 1236 params.mExcludedFiles << " files excluded, " << 1237 params.mUncheckedFiles << " files not checked)"); 1222 1238 1223 1239 // Set return code? … … 1254 1270 if(!locations.SubConfigurationExists(rLocation.c_str())) 1255 1271 { 1256 printf("Location %s does not exist.\n", rLocation.c_str());1272 BOX_ERROR("Location " << rLocation << " does not exist."); 1257 1273 return; 1258 1274 } … … 1265 1281 DIRECTORY_SEPARATOR_ASCHAR) 1266 1282 { 1267 fprintf(stderr, "Warning: location '%s' path ends "1268 "with ' %s', compare may fail!",1269 rLocation.c_str(), DIRECTORY_SEPARATOR);1283 BOX_WARNING("Location '" << rLocation << "' path ends " 1284 "with '" DIRECTORY_SEPARATOR "', " 1285 "compare may fail!"); 1270 1286 } 1271 1287 } … … 1320 1336 if(dirID == 0) 1321 1337 { 1322 printf("Local directory '%s' exists, but"1323 " server directory '%s' does not exist\n",1324 rLocalDir.c_str(), rStoreDir.c_str());1338 BOX_WARNING("Local directory '" << rLocalDir << "' exists, " 1339 "but server directory '" << rStoreDir << "' does not " 1340 "exist."); 1325 1341 rParams.mDifferences ++; 1326 1342 return; … … 1370 1386 if(errno == ENOTDIR) 1371 1387 { 1372 printf("Local object '%s' is a file, " 1373 "server object '%s' is a directory\n", 1374 localDirDisplay.c_str(), 1375 storeDirDisplay.c_str()); 1388 BOX_WARNING("Local object '" << localDirDisplay << "' " 1389 "is a file, server object '" << 1390 storeDirDisplay << "' is a directory."); 1376 1391 rParams.mDifferences ++; 1377 1392 } 1378 1393 else if(errno == ENOENT) 1379 1394 { 1380 printf("Local directory '%s' does not exist " 1381 "(compared to server directory '%s')\n", 1382 localDirDisplay.c_str(), 1383 storeDirDisplay.c_str()); 1395 BOX_WARNING("Local directory '" << localDirDisplay << 1396 "' does not exist (compared to server " 1397 "directory '" << storeDirDisplay << "')."); 1384 1398 rParams.mDifferences ++; 1385 1399 } 1386 1400 else 1387 1401 { 1388 printf("ERROR: stat on local dir '%s'\n", 1389 localDirDisplay.c_str()); 1402 BOX_WARNING("Failed to access local directory '" << 1403 localDirDisplay << ": " << strerror(errno) << 1404 "'."); 1390 1405 rParams.mUncheckedFiles ++; 1391 1406 } … … 1408 1423 if(!dir.HasAttributes()) 1409 1424 { 1410 printf("Store directory '%s' doesn't have attributes.\n",1411 storeDirDisplay.c_str());1425 BOX_WARNING("Store directory '" << storeDirDisplay << "' " 1426 "doesn't have attributes."); 1412 1427 } 1413 1428 else … … 1424 1439 if(!(attr.Compare(localAttr, true, true /* ignore modification times */))) 1425 1440 { 1426 printf("Local directory '%s' has different attributes " 1427 "to store directory '%s'.\n", 1428 localDirDisplay.c_str(), 1429 storeDirDisplay.c_str()); 1441 BOX_WARNING("Local directory '" << localDirDisplay << 1442 "' has different attributes to store " 1443 "directory '" << storeDirDisplay << "'."); 1430 1444 rParams.mDifferences ++; 1431 1445 } … … 1436 1450 if(dirhandle == 0) 1437 1451 { 1438 printf("ERROR: opendir on local dir '%s'\n",1439 localDirDisplay .c_str());1452 BOX_WARNING("Failed to open local directory '" << 1453 localDirDisplay << "': " << strerror(errno)); 1440 1454 rParams.mUncheckedFiles ++; 1441 1455 return; … … 1458 1472 if (localDirEn->d_type != DT_DIR) 1459 1473 { 1460 fprintf(stderr, "ERROR: d_type does"1461 " not really work on your"1462 " platform. Reconfigure Box!\n");1474 BOX_ERROR("d_type does not really " 1475 "work on your platform. " 1476 "Reconfigure Box!"); 1463 1477 return; 1464 1478 } … … 1505 1519 if(::closedir(dirhandle) != 0) 1506 1520 { 1507 printf("ERROR: closedir on local dir '%s'\n",1508 localDirDisplay .c_str());1521 BOX_ERROR("Failed to close local directory '" << 1522 localDirDisplay << "': " << strerror(errno)); 1509 1523 } 1510 1524 dirhandle = 0; … … 1566 1580 { 1567 1581 // Not found -- report 1568 printf("Local file '%s' does not exist, "1569 "but store file '%s' does.\n",1570 localPathDisplay.c_str(),1571 storePathDisplay .c_str());1582 BOX_WARNING("Local file '" << 1583 localDirDisplay << "' does not exist, " 1584 "but store file '" << 1585 storePathDisplay << "' does."); 1572 1586 rParams.mDifferences ++; 1573 1587 } … … 1644 1658 fileOnServerStream->IsSymLink() /* ignore modification time if it's a symlink */)) 1645 1659 { 1646 printf("Local file '%s' " 1647 "has different attributes " 1648 "to store file '%s'.\n", 1649 localPathDisplay.c_str(), 1650 storePathDisplay.c_str()); 1660 BOX_WARNING("Local file '" << 1661 localPathDisplay << 1662 "' has different attributes " 1663 "to store file '" << 1664 storePathDisplay << 1665 "'."); 1651 1666 rParams.mDifferences ++; 1652 1667 if(modifiedAfterLastSync) 1653 1668 { 1654 1669 rParams.mDifferencesExplainedByModTime ++; 1655 printf("(the file above was modified after the last sync time -- might be reason for difference)\n");1670 BOX_INFO("(the file above was modified after the last sync time -- might be reason for difference)"); 1656 1671 } 1657 1672 else if(i->second->HasAttributes()) 1658 1673 { 1659 printf("(the file above has had new attributes applied)\n");1674 BOX_INFO("(the file above has had new attributes applied)\n"); 1660 1675 } 1661 1676 } … … 1723 1738 if(!equal) 1724 1739 { 1725 printf("Local file '%s' " 1740 BOX_WARNING("Local file '" << 1741 localPathDisplay << "' " 1726 1742 "has different contents " 1727 "to store file ' %s'.\n",1728 localPathDisplay.c_str(),1729 storePathDisplay.c_str());1743 "to store file '" << 1744 storePathDisplay << 1745 "'."); 1730 1746 rParams.mDifferences ++; 1731 1747 if(modifiedAfterLastSync) 1732 1748 { 1733 1749 rParams.mDifferencesExplainedByModTime ++; 1734 printf("(the file above was modified after the last sync time -- might be reason for difference)\n");1750 BOX_INFO("(the file above was modified after the last sync time -- might be reason for difference)"); 1735 1751 } 1736 1752 else if(i->second->HasAttributes()) 1737 1753 { 1738 printf("(the file above has had new attributes applied)\n");1754 BOX_INFO("(the file above has had new attributes applied)\n"); 1739 1755 } 1740 1756 } … … 1795 1811 !(rParams.mpExcludeFiles->IsExcluded(localPath))) 1796 1812 { 1797 printf("Local file '%s' exists, "1798 "but store file '%s' "1799 " does not exist.\n",1800 localPathDisplay.c_str(),1801 storePathDisplay.c_str());1813 BOX_WARNING("Local file '" << 1814 localPathDisplay << 1815 "' exists, but store file '" << 1816 storePathDisplay << 1817 "' does not."); 1802 1818 rParams.mDifferences ++; 1803 1819 … … 1810 1826 { 1811 1827 rParams.mDifferencesExplainedByModTime ++; 1812 printf("(the file above was modified after the last sync time -- might be reason for difference)\n");1828 BOX_INFO("(the file above was modified after the last sync time -- might be reason for difference)"); 1813 1829 } 1814 1830 } … … 1853 1869 { 1854 1870 // Not found -- report 1855 printf("Local directory '%s' is excluded, but "1856 "store directory '%s' still exists.\n",1857 localPathDisplay.c_str(),1858 storePathDisplay .c_str());1871 BOX_WARNING("Local directory '" << 1872 localPathDisplay << "' is excluded, " 1873 "but store directory '" << 1874 storePathDisplay << "' still exists."); 1859 1875 rParams.mDifferences ++; 1860 1876 } … … 1862 1878 { 1863 1879 // Not found -- report 1864 printf("Local directory '%s' does not exist, "1865 "but store directory '%s' does.\n",1866 localPathDisplay.c_str(),1867 storePathDisplay .c_str());1880 BOX_WARNING("Local directory '" << 1881 localPathDisplay << "' does not exist, " 1882 "but store directory '" << 1883 storePathDisplay << "' does."); 1868 1884 rParams.mDifferences ++; 1869 1885 } … … 1909 1925 if(rParams.mpExcludeDirs == 0 || !(rParams.mpExcludeDirs->IsExcluded(localPath))) 1910 1926 { 1911 printf("Local directory '%s' exists, but "1912 "store directory '%s' does not exist.\n",1913 localPathDisplay.c_str(),1914 storePathDisplay .c_str());1927 BOX_WARNING("Local directory '" << 1928 localPathDisplay << "' exists, but " 1929 "store directory '" << 1930 storePathDisplay << "' does not."); 1915 1931 rParams.mDifferences ++; 1916 1932 } … … 1945 1961 if(args.size() != 2) 1946 1962 { 1947 printf("Incorrect usage.\nrestore [-d] [-r] [-i] <directory-name> <local-directory-name>\n");1963 BOX_ERROR("Incorrect usage. restore [-d] [-r] [-i] <remote-name> <local-name>"); 1948 1964 return; 1949 1965 } … … 1960 1976 if(dirID == std::numeric_limits<long long>::min() || dirID == std::numeric_limits<long long>::max() || dirID == 0) 1961 1977 { 1962 printf("Not a valid object ID (specified in hex)\n");1978 BOX_ERROR("Not a valid object ID (specified in hex)"); 1963 1979 return; 1964 1980 } … … 1983 1999 if(dirID == 0) 1984 2000 { 1985 printf("Directory '%s' not found on server\n", args[0].c_str());2001 BOX_ERROR("Directory '" << args[0] << "' not found on server"); 1986 2002 return; 1987 2003 } 1988 2004 if(dirID == BackupProtocolClientListDirectory::RootDirectory) 1989 2005 { 1990 printf("Cannot restore the root directory -- restore locations individually.\n");2006 BOX_ERROR("Cannot restore the root directory -- restore locations individually."); 1991 2007 return; 1992 2008 } … … 2024 2040 { 2025 2041 case Restore_Complete: 2026 printf("Restore complete\n");2042 BOX_INFO("Restore complete."); 2027 2043 break; 2028 2044 2029 2045 case Restore_ResumePossible: 2030 printf("Resume possible -- repeat command with -r flag to resume\n");2046 BOX_ERROR("Resume possible -- repeat command with -r flag to resume"); 2031 2047 break; 2032 2048 2033 2049 case Restore_TargetExists: 2034 printf("The target directory exists. You cannot restore over an existing directory.\n");2050 BOX_ERROR("The target directory exists. You cannot restore over an existing directory."); 2035 2051 break; 2036 2052 2037 2053 #ifdef WIN32 2038 2054 case Restore_TargetPathNotFound: 2039 printf("The target directory path does not exist.\n"2055 BOX_ERROR("The target directory path does not exist.\n" 2040 2056 "To restore to a directory whose parent " 2041 "does not exist, create the parent first. \n");2057 "does not exist, create the parent first."); 2042 2058 break; 2043 2059 #endif 2044 2060 2045 2061 case Restore_UnknownError: 2046 printf("Unknown error during restore.\n");2062 BOX_ERROR("Unknown error during restore."); 2047 2063 break; 2048 2064 2049 2065 default: 2050 printf("ERROR: Unknown restore result %d.\n", result);2066 BOX_ERROR("Unknown restore result " << result << "."); 2051 2067 break; 2052 2068 } … … 2168 2184 if(args.size() != 1) 2169 2185 { 2170 printf("Incorrect usage.\nundelete <directory-name>\n");2186 BOX_ERROR("Incorrect usage. undelete <directory-name>"); 2171 2187 return; 2172 2188 } … … 2186 2202 if(dirID == 0) 2187 2203 { 2188 printf("Directory '%s' not found on server\n", args[0].c_str());2204 BOX_ERROR("Directory '" << args[0] << "' not found on server."); 2189 2205 return; 2190 2206 } 2191 2207 if(dirID == BackupProtocolClientListDirectory::RootDirectory) 2192 2208 { 2193 printf("Cannot undelete the root directory.\n");2209 BOX_ERROR("Cannot undelete the root directory."); 2194 2210 return; 2195 2211 } -
box/chris/general/bin/bbackupquery/bbackupquery.cpp
r1690 r1790 13 13 #include <unistd.h> 14 14 #endif 15 16 #include <errno.h> 15 17 #include <stdio.h> 16 #include <sys/types.h> 18 19 #ifdef HAVE_SYS_TYPES_H 20 #include <sys/types.h> 21 #endif 22 17 23 #ifdef HAVE_LIBREADLINE 18 24 #ifdef HAVE_READLINE_READLINE_H … … 169 175 if(logFile == 0) 170 176 { 171 printf("Can't open log file '%s'\n", optarg); 177 BOX_ERROR("Failed to open log file '" << 178 optarg << "': " << strerror(errno)); 172 179 } 173 180 break; … … 202 209 if (!SetConsoleCP(CP_UTF8)) 203 210 { 204 fprintf(stderr, "Failed to set input codepage: "205 "error %d\n", GetLastError());211 BOX_ERROR("Failed to set input codepage: " << 212 GetErrorMessage(GetLastError())); 206 213 } 207 214 208 215 if (!SetConsoleOutputCP(CP_UTF8)) 209 216 { 210 fprintf(stderr, "Failed to set output codepage: "211 "error %d\n", GetLastError());217 BOX_ERROR("Failed to set output codepage: " << 218 GetErrorMessage(GetLastError())); 212 219 } 213 220 … … 223 230 224 231 // Read in the configuration file 225 if(!quiet) printf("Using configuration file %s\n", 226 configFilename.c_str()); 232 if(!quiet) BOX_INFO("Using configuration file " << configFilename); 227 233 228 234 std::string errs; … … 233 239 if(config.get() == 0 || !errs.empty()) 234 240 { 235 printf("Invalid configuration file:\n%s", errs.c_str());241 BOX_FATAL("Invalid configuration file: " << errs); 236 242 return 1; 237 243 } … … 253 259 254 260 // 2. Connect to server 255 if(!quiet) printf("Connecting to store...\n");261 if(!quiet) BOX_INFO("Connecting to store..."); 256 262 SocketStreamTLS socket; 257 263 socket.Open(tlsContext, Socket::TypeINET, conf.GetKeyValue("StoreHostname").c_str(), BOX_PORT_BBSTORED); 258 264 259 265 // 3. Make a protocol, and handshake 260 if(!quiet) printf("Handshake with store...\n");266 if(!quiet) BOX_INFO("Handshake with store..."); 261 267 BackupProtocolClient connection(socket); 262 268 connection.Handshake(); … … 269 275 270 276 // 4. Log in to server 271 if(!quiet) printf("Login to store...\n");277 if(!quiet) BOX_INFO("Login to store..."); 272 278 // Check the version of the server 273 279 { … … 346 352 347 353 // Done... stop nicely 348 if(!quiet) printf("Logging off...\n");354 if(!quiet) BOX_INFO("Logging off..."); 349 355 connection.QueryFinished(); 350 if(!quiet) printf("Session finished.\n");356 if(!quiet) BOX_INFO("Session finished."); 351 357 352 358 // Return code -
box/chris/general/bin/bbstoreaccounts/bbstoreaccounts.cpp
r1690 r1790 38 38 if(SoftLimit >= HardLimit) 39 39 { 40 printf("ERROR: Soft limit must be less than the hard limit.\n");40 BOX_FATAL("Soft limit must be less than the hard limit."); 41 41 exit(1); 42 42 } 43 43 if(SoftLimit > ((HardLimit * MAX_SOFT_LIMIT_SIZE) / 100)) 44 44 { 45 printf("ERROR: Soft limit must be no more than %d%% of the hard limit.\n", MAX_SOFT_LIMIT_SIZE); 45 BOX_FATAL("Soft limit must be no more than " << 46 MAX_SOFT_LIMIT_SIZE << "% of the hard limit."); 46 47 exit(1); 47 48 } … … 54 55 if(DiscSet < 0 || DiscSet >= controller.GetNumDiscSets()) 55 56 { 56 printf("Disc set %d does not exist\n", DiscSet);57 BOX_FATAL("Disc set " << DiscSet << " does not exist."); 57 58 exit(1); 58 59 } … … 90 91 if(endptr == string || number == LONG_MIN || number == LONG_MAX) 91 92 { 92 printf("%s is an invalid number\n", string);93 BOX_FATAL("'" << string << "' is not a valid number."); 93 94 exit(1); 94 95 } … … 117 118 118 119 default: 119 printf("%s has an invalid units specifier\nUse B for blocks, M for Mb, G for Gb, eg 2Gb\n", string); 120 BOX_FATAL(string << " has an invalid units specifier " 121 "(use B for blocks, M for Mb, G for Gb, eg 2Gb)"); 120 122 exit(1); 121 123 break; … … 144 146 { 145 147 // Couldn't lock the account -- just stop now 146 printf("Couldn't lock the account -- did not change the limits\nTry again later.\n"); 148 BOX_ERROR("Failed to lock the account, did not change limits. " 149 "Try again later."); 147 150 return 1; 148 151 } … … 169 172 if(!db->EntryExists(ID)) 170 173 { 171 printf("Account %x does not exist\n", ID); 174 BOX_ERROR("Account " << BOX_FORMAT_ACCOUNT(ID) << 175 " does not exist."); 172 176 return 1; 173 177 } … … 199 203 info->Save(); 200 204 201 printf("Limits on account 0x%08x changed to %lld soft, %lld hard\n", ID, softlimit, hardlimit); 205 BOX_NOTICE("Limits on account " << BOX_FORMAT_ACCOUNT(ID) << 206 " changed to " << softlimit << " soft, " << 207 hardlimit << " hard."); 202 208 203 209 return 0; … … 212 218 if(!db->EntryExists(ID)) 213 219 { 214 printf("Account %x does not exist\n", ID); 220 BOX_ERROR("Account " << BOX_FORMAT_ACCOUNT(ID) << 221 " does not exist."); 215 222 return 1; 216 223 } … … 242 249 if(AskForConfirmation) 243 250 { 244 ::printf("Really delete account %08x?\n(type 'yes' to confirm)\n", ID); 251 BOX_WARNING("Really delete account " << 252 BOX_FORMAT_ACCOUNT(ID) << "? (type 'yes' to confirm)"); 245 253 char response[256]; 246 254 if(::fgets(response, sizeof(response), stdin) == 0 || ::strcmp(response, "yes\n") != 0) 247 255 { 248 printf("Deletion cancelled\n");256 BOX_NOTICE("Deletion cancelled."); 249 257 return 0; 250 258 } … … 257 265 if(!db->EntryExists(ID)) 258 266 { 259 printf("Account %x does not exist\n", ID); 267 BOX_ERROR("Account " << BOX_FORMAT_ACCOUNT(ID) << 268 " does not exist."); 260 269 return 1; 261 270 } … … 319 328 } 320 329 } 321 330 331 int retcode = 0; 332 322 333 // Thirdly, delete the directories... 323 334 for(std::vector<std::string>::const_iterator d(toDelete.begin()); d != toDelete.end(); ++d) 324 335 { 325 ::printf("Deleting store directory %s...\n", (*d).c_str());336 BOX_NOTICE("Deleting store directory " << (*d) << "..."); 326 337 // Just use the rm command to delete the files 327 338 std::string cmd("rm -rf "); … … 330 341 if(::system(cmd.c_str()) != 0) 331 342 { 332 ::printf("ERROR: Deletion of %s failed.\n(when cleaning up, remember to delete all raid directories)\n", (*d).c_str()); 333 return 1; 343 BOX_ERROR("Failed to delete files in " << (*d) << 344 ", delete them manually."); 345 retcode = 1; 334 346 } 335 347 } 336 348 337 349 // Success! 338 return 0;350 return retcode; 339 351 } 340 352 … … 347 359 if(!db->EntryExists(ID)) 348 360 { 349 printf("Account %x does not exist\n", ID); 361 BOX_ERROR("Account " << BOX_FORMAT_ACCOUNT(ID) << 362 " does not exist."); 350 363 return 1; 351 364 } … … 382 395 if(db->EntryExists(ID)) 383 396 { 384 printf("Account %x already exists\n", ID); 397 BOX_ERROR("Account " << BOX_FORMAT_ACCOUNT(ID) << 398 " already exists."); 385 399 return 1; 386 400 } … … 390 404 acc.Create(ID, DiscNumber, SoftLimit, HardLimit, rUsername); 391 405 392 printf("Account %x created\n", ID);406 BOX_NOTICE("Account " << BOX_FORMAT_ACCOUNT(ID) << " created."); 393 407 394 408 return 0; … … 445 459 if(config.get() == 0 || !errs.empty()) 446 460 { 447 printf("Invalid configuration file:\n%s", errs.c_str()); 461 BOX_ERROR("Invalid configuration file " << configFilename << 462 ":" << errs); 448 463 } 449 464 … … 485 500 || ::sscanf(argv[2], "%d", &discnum) != 1) 486 501 { 487 printf("create requires raid file disc number, soft and hard limits\n"); 502 BOX_ERROR("create requires raid file disc number, " 503 "soft and hard limits."); 488 504 return 1; 489 505 } … … 507 523 if(argc < 4) 508 524 { 509 printf("setlimit requires soft and hard limits\n");525 BOX_ERROR("setlimit requires soft and hard limits."); 510 526 return 1; 511 527 } … … 541 557 else 542 558 { 543 ::printf("Unknown option %s.\n", argv[o]);559 BOX_ERROR("Unknown option " << argv[o] << "."); 544 560 return 2; 545 561 } … … 551 567 else 552 568 { 553 printf("Unknown command '%s'\n", argv[0]);569 BOX_ERROR("Unknown command '" << argv[0] << "'."); 554 570 return 1; 555 571 } -
box/chris/general/lib/backupclient/BackupClientRestore.cpp
r1784 r1790 261 261 { 262 262 // File exists with this name, which is fun. Get rid of it. 263 ::printf("WARNING: File present with name '%s', removing out of the way of restored directory. Use specific restore with ID to restore this object.", rLocalDirectoryName.c_str()); 263 BOX_WARNING("File present with name '" << 264 rLocalDirectoryName << "', removing " << 265 "out of the way of restored directory. " 266 "Use specific restore with ID to " 267 "restore this object."); 264 268 if(::unlink(rLocalDirectoryName.c_str()) != 0) 265 269 { -
box/chris/general/lib/backupstore/BackupStoreCheck.cpp
r969 r1790 103 103 if(!mQuiet) 104 104 { 105 ::printf("Couldn't lock the account -- did not check.\nTry again later after the client has disconnected.\nAlternatively, forcibly kill the server.\n");105 BOX_ERROR("Failed to lock the account -- did not check.\nTry again later after the client has disconnected.\nAlternatively, forcibly kill the server."); 106 106 } 107 107 THROW_EXCEPTION(BackupStoreException, CouldNotLockStoreAccount) … … 111 111 if(!mQuiet && mFixErrors) 112 112 { 113 ::printf("NOTE: Will fix errors encountered during checking.\n");113 BOX_NOTICE("Will fix errors encountered during checking."); 114 114 } 115 115 … … 117 117 if(!mQuiet) 118 118 { 119 ::printf("Check store account ID %08x\nPhase 1, check objects...\n", mAccountID); 119 BOX_INFO("Checking store account ID " << 120 BOX_FORMAT_ACCOUNT(mAccountID) << "..."); 121 BOX_INFO("Phase 1, check objects..."); 120 122 } 121 123 CheckObjects(); … … 124 126 if(!mQuiet) 125 127 { 126 ::printf("Phase 2, check directories...\n");128 BOX_INFO("Phase 2, check directories..."); 127 129 } 128 130 CheckDirectories(); … … 131 133 if(!mQuiet) 132 134 { 133 ::printf("Phase 3, check root...\n");135 BOX_INFO("Phase 3, check root..."); 134 136 } 135 137 CheckRoot(); … … 138 140 if(!mQuiet) 139 141 { 140 ::printf("Phase 4, fix unattached objects...\n");142 BOX_INFO("Phase 4, fix unattached objects..."); 141 143 } 142 144 CheckUnattachedObjects(); … … 145 147 if(!mQuiet) 146 148 { 147 ::printf("Phase 5, fix unrecovered inconsistencies...\n");149 BOX_INFO("Phase 5, fix unrecovered inconsistencies..."); 148 150 } 149 151 FixDirsWithWrongContainerID(); … … 153 155 if(!mQuiet) 154 156 { 155 ::printf("Phase 6, regenerate store info...\n");157 BOX_INFO("Phase 6, regenerate store info..."); 156 158 } 157 159 WriteNewStoreInfo(); … … 161 163 if(mNumberErrorsFound > 0) 162 164 { 163 ::printf("%lld errors found\n", mNumberErrorsFound); 165 BOX_WARNING("Finished checking store account ID " << 166 BOX_FORMAT_ACCOUNT(mAccountID) << ": " << 167 mNumberErrorsFound << " errors found"); 164 168 if(!mFixErrors) 165 169 { 166 ::printf("NOTE: No changes to the store account have been made.\n"); 170 BOX_WARNING("No changes to the store account " 171 "have been made."); 167 172 } 168 173 if(!mFixErrors && mNumberErrorsFound > 0) 169 174 { 170 ::printf("Run again with fix option to fix these errors\n"); 171 } 172 if(mNumberErrorsFound > 0) 173 { 174 ::printf("You should now use bbackupquery on the client machine to examine the store.\n"); 175 BOX_WARNING("Run again with fix option to " 176 "fix these errors"); 177 } 178 if(mFixErrors && mNumberErrorsFound > 0) 179 { 180 BOX_WARNING("You should now use bbackupquery " 181 "on the client machine to examine the store."); 175 182 if(mLostAndFoundDirectoryID != 0) 176 183 { 177 ::printf("A lost+found directory was created in the account root.\n"\ 178 "This contains files and directories which could not be matched to existing directories.\n"\ 179 "bbackupd will delete this directory in a few days time.\n"); 184 BOX_WARNING("A lost+found directory was " 185 "created in the account root.\n" 186 "This contains files and directories " 187 "which could not be matched to " 188 "existing directories.\n"\ 189 "bbackupd will delete this directory " 190 "in a few days time."); 180 191 } 181 192 } … … 183 194 else 184 195 { 185 ::printf("Store account checked, no errors found.\n"); 196 BOX_NOTICE("Finished checking store account ID " << 197 BOX_FORMAT_ACCOUNT(mAccountID) << ": " 198 "no errors found"); 186 199 } 187 200 } … … 305 318 else 306 319 { 307 ::printf("Spurious or invalid directory %s/%s found%s -- delete manually\n", rDirName.c_str(), (*i).c_str(), mFixErrors?", deleting":""); 320 BOX_WARNING("Spurious or invalid directory " << 321 rDirName << DIRECTORY_SEPARATOR << 322 (*i) << " found, " << 323 (mFixErrors?"deleting":"delete manually")); 308 324 ++mNumberErrorsFound; 309 325 } … … 337 353 if(!RaidFileRead::DirectoryExists(mDiscSetNumber, dirName)) 338 354 { 339 TRACE1("RaidFile dir %s does not exist\n", dirName.c_str());355 BOX_WARNING("RaidFile dir " << dirName << " does not exist"); 340 356 return; 341 357 } … … 379 395 { 380 396 // Unexpected or bad file, delete it 381 ::printf("Spurious file %s" DIRECTORY_SEPARATOR "%s "382 "found%s\n", dirName.c_str(), (*i).c_str(),383 mFixErrors?", deleting":"");397 BOX_WARNING("Spurious file " << dirName << 398 DIRECTORY_SEPARATOR << (*i) << " found" << 399 (mFixErrors?", deleting":"")); 384 400 ++mNumberErrorsFound; 385 401 if(mFixErrors) … … 402 418 { 403 419 // File was bad, delete it 404 ::printf("Corrupted file %s%s found%s\n", dirName.c_str(), leaf, mFixErrors?", deleting":""); 420 BOX_WARNING("Corrupted file " << dirName << 421 leaf << " found" << 422 (mFixErrors?", deleting":"")); 405 423 ++mNumberErrorsFound; 406 424 if(mFixErrors) … … 510 528 { 511 529 // Get that dodgy thing deleted! 512 ::printf("Have file as root directory. This is bad.\n");530 BOX_ERROR("Have file as root directory. This is bad."); 513 531 return -1; 514 532 } … … 597 615 { 598 616 // Wasn't quite right, and has been modified 599 ::printf("Directory ID %llx has bad structure\n", pblock->mID[e]); 617 BOX_WARNING("Directory ID " << 618 BOX_FORMAT_OBJECTID(pblock->mID[e]) << 619 " has bad structure"); 600 620 ++mNumberErrorsFound; 601 621 isModified = true; … … 623 643 { 624 644 // Entry is of wrong type 625 ::printf("Directory ID %llx references object %llx which has a different type than expected.\n", pblock->mID[e], en->GetObjectID()); 645 BOX_WARNING("Directory ID " << 646 BOX_FORMAT_OBJECTID(pblock->mID[e]) << 647 " references object " << 648 BOX_FORMAT_OBJECTID(en->GetObjectID()) << 649 " which has a different type than expected."); 626 650 badEntry = true; 627 651 } … … 631 655 if(iflags & Flags_IsContained) 632 656 { 657 BOX_WARNING("Directory ID " << 658 BOX_FORMAT_OBJECTID(pblock->mID[e]) << 659 " references object " << 660 BOX_FORMAT_OBJECTID(en->GetObjectID()) << 661 " which is already contained."); 633 662 badEntry = true; 634 ::printf("Directory ID %llx references object %llx which is already contained.\n", pblock->mID[e], en->GetObjectID());635 663 } 636 664 else … … 646 674 { 647 675 // Add to will fix later list 648 ::printf("Directory ID %llx has wrong container ID.\n", en->GetObjectID());676 BOX_WARNING("Directory ID " << BOX_FORMAT_OBJECTID(en->GetObjectID()) << " has wrong container ID."); 649 677 mDirsWithWrongContainerID.push_back(en->GetObjectID()); 650 678 } … … 652 680 { 653 681 // This is OK for files, they might move 654 ::printf("File ID %llx has different container ID, probably moved\n", en->GetObjectID());682 BOX_WARNING("File ID " << BOX_FORMAT_OBJECTID(en->GetObjectID()) << " has different container ID, probably moved"); 655 683 } 656 684 … … 671 699 isModified = true; 672 700 // Tell user 673 ::printf("Directory ID %llx has wrong size for object %llx\n", pblock->mID[e], en->GetObjectID());701 BOX_WARNING("Directory ID " << BOX_FORMAT_OBJECTID(pblock->mID[e]) << " has wrong size for object " << BOX_FORMAT_OBJECTID(en->GetObjectID())); 674 702 } 675 703 } … … 687 715 // Just remove the entry 688 716 badEntry = true; 689 ::printf("Directory ID %llx references object %llx which does not exist.\n", pblock->mID[e], en->GetObjectID());717 BOX_WARNING("Directory ID " << BOX_FORMAT_OBJECTID(pblock->mID[e]) << " references object " << BOX_FORMAT_OBJECTID(en->GetObjectID()) << " which does not exist."); 690 718 } 691 719 } … … 730 758 if(isModified && mFixErrors) 731 759 { 732 ::printf("Fixing directory ID %llx\n", pblock->mID[e]);760 BOX_WARNING("Fixing directory ID " << BOX_FORMAT_OBJECTID(pblock->mID[e])); 733 761 734 762 // Save back to disc -
box/chris/general/lib/backupstore/BackupStoreCheck2.cpp
r1149 r1790 48 48 else 49 49 { 50 ::printf("Root directory doesn't exist\n");50 BOX_WARNING("Root directory doesn't exist"); 51 51 52 52 ++mNumberErrorsFound; … … 119 119 { 120 120 // Unattached object... 121 ::printf("Object %llx is unattached.\n", pblock->mID[e]);121 BOX_WARNING("Object " << BOX_FORMAT_OBJECTID(pblock->mID[e]) << " is unattached."); 122 122 ++mNumberErrorsFound; 123 123 … … 148 148 if(diffFromObjectID != 0) 149 149 { 150 ::printf("Object %llx is unattached, and is a patch. Deleting, cannot reliably recover.\n", pblock->mID[e]);150 BOX_WARNING("Object " << BOX_FORMAT_OBJECTID(pblock->mID[e]) << " is unattached, and is a patch. Deleting, cannot reliably recover."); 151 151 152 152 // Delete this object instead … … 230 230 if(!mFixErrors) 231 231 { 232 ::printf("Missing directory %llx could be recreated\n", MissingDirectoryID); 232 BOX_WARNING("Missing directory " << 233 BOX_FORMAT_OBJECTID(MissingDirectoryID) << 234 " could be recreated."); 233 235 mDirsAdded.insert(MissingDirectoryID); 234 236 return true; 235 237 } 236 ::printf("Recreating missing directory %llx\n", MissingDirectoryID); 238 239 BOX_WARNING("Recreating missing directory " << 240 BOX_FORMAT_OBJECTID(MissingDirectoryID)); 237 241 238 242 // Create a blank directory … … 301 305 { 302 306 // Found a name which can be used 303 ::printf("Lost and found dir has name %s\n",name);307 BOX_WARNING("Lost and found dir has name " << name); 304 308 break; 305 309 } … … 525 529 catch(...) 526 530 { 527 ::printf("Load of existing store info failed, regenerating.\n");531 BOX_WARNING("Load of existing store info failed, regenerating."); 528 532 ++mNumberErrorsFound; 529 533 } … … 552 556 else 553 557 { 554 ::printf("NOTE: Soft limit for account changed to ensure housekeeping doesn't delete files on next run\n");558 BOX_WARNING("Soft limit for account changed to ensure housekeeping doesn't delete files on next run."); 555 559 } 556 560 if(poldInfo.get() != 0 && poldInfo->GetBlocksHardLimit() > minHard) … … 560 564 else 561 565 { 562 ::printf("NOTE: Hard limit for account changed to ensure housekeeping doesn't delete files on next run\n");566 BOX_WARNING("Hard limit for account changed to ensure housekeeping doesn't delete files on next run."); 563 567 } 564 568 … … 587 591 { 588 592 info->Save(); 589 ::printf("New store info file written successfully.\n");593 BOX_NOTICE("New store info file written successfully."); 590 594 } 591 595 } -
box/chris/general/lib/common/DebugMemLeakFinder.cpp
r1341 r1790 375 375 else 376 376 { 377 printf("WARNING: Couldn't open memory leak results file %s for appending\n", filename); 377 BOX_WARNING("Couldn't open memory leak results file " << 378 filename << " for appending"); 378 379 } 379 380 } -
box/chris/general/lib/common/Logging.cpp
r1642 r1790 244 244 msg += "[" + sTag + "] "; 245 245 } 246 247 if (level <= Log::FATAL) 248 { 249 msg += "FATAL: "; 250 } 251 else if (level <= Log::ERROR) 252 { 253 msg += "ERROR: "; 254 } 255 else if (level <= Log::WARNING) 256 { 257 msg += "WARNING: "; 258 } 259 else if (level <= Log::NOTICE) 260 { 261 msg += "NOTICE: "; 262 } 246 263 247 264 msg += rMessage; … … 273 290 case Log::EVERYTHING: syslogLevel = LOG_DEBUG; break; 274 291 } 275 276 syslog(syslogLevel, "%s", rMessage.c_str()); 292 293 std::string msg; 294 295 if (level <= Log::FATAL) 296 { 297 msg = "FATAL: "; 298 } 299 else if (level <= Log::ERROR) 300 { 301 msg = "ERROR: "; 302 } 303 else if (level <= Log::WARNING) 304 { 305 msg = "WARNING: "; 306 } 307 else if (level <= Log::NOTICE) 308 { 309 msg = "NOTICE: "; 310 } 311 312 msg += rMessage; 313 314 syslog(syslogLevel, "%s", msg.c_str()); 277 315 278 316 return true; -
box/chris/general/lib/crypto/Random.cpp
r356 r1790 35 35 } 36 36 #else 37 ::fprintf(stderr, "No random device -- additional seeding of random number generator not performed.\n"); 37 BOX_ERROR("No random device -- additional seeding of random number " 38 "generator not performed."); 38 39 #endif 39 40 } -
box/chris/general/lib/raidfile/RaidFileController.cpp
r1683 r1790 103 103 if(pconfig.get() == 0 || !err.empty()) 104 104 { 105 fprintf(stderr, "RaidFile configuation file errors:\n%s", 106 err.c_str()); 105 BOX_ERROR("RaidFile configuration file errors: " << err); 107 106 THROW_EXCEPTION(RaidFileException, BadConfigFile) 108 107 } -
box/chris/general/lib/server/SSLLib.cpp
r1784 r1790 50 50 } 51 51 #else 52 ::fprintf(stderr, "No random device -- additional seeding of random number generator not performed.\n"); 52 BOX_WARNING("No random device -- additional seeding of " 53 "random number generator not performed."); 53 54 #endif 54 55 } -
box/chris/general/test/bbackupd/testfiles/extcheck1.pl.in
r675 r1790 4 4 my $flags = $ARGV[0] or ""; 5 5 6 unless(open IN,"../../bin/bbackupquery/bbackupquery -q -c testfiles/bbackupd.conf -l testfiles/query4.log \"compare -ac$flags\" quit |")6 unless(open IN,"../../bin/bbackupquery/bbackupquery -q -c testfiles/bbackupd.conf -l testfiles/query4.log \"compare -ac$flags\" quit 2>&1 |") 7 7 { 8 8 print "Couldn't open compare utility\n"; -
box/chris/general/test/bbackupd/testfiles/extcheck2.pl.in
r675 r1790 4 4 my $flags = $ARGV[0] or ""; 5 5 6 unless(open IN,"../../bin/bbackupquery/bbackupquery -q -c testfiles/bbackupd.conf -l testfiles/query4.log \"compare -ac$flags\" quit |")6 unless(open IN,"../../bin/bbackupquery/bbackupquery -q -c testfiles/bbackupd.conf -l testfiles/query4.log \"compare -ac$flags\" quit 2>&1 |") 7 7 { 8 8 print "Couldn't open compare utility\n";
Note: See TracChangeset
for help on using the changeset viewer.
