Replace printf with LogPrintf / LogPrint

Conflicts:
	src/addrman.cpp
	src/core.cpp
	src/db.cpp
	src/init.cpp
	src/leveldb.cpp
	src/leveldb.h
	src/main.cpp
	src/miner.cpp
	src/net.cpp
	src/net.h
	src/noui.cpp
	src/rpcdump.cpp
	src/script.h
	src/txdb.cpp
	src/util.cpp
	src/util.h
	src/wallet.cpp
	src/walletdb.cpp
fix some printf -> LogPrintf leftovers

Conflicts:
	src/main.h
Make -DDEBUGLOCKORDER + -debug less noisy

Print out every mutex lock/unlock if compiled -DDEBUGLOCKORDER
only if -debug=lock is set.
re-work -debug switch handling

- re-work -debug help message text
- make -debug log every debugging information again (even all categories)
- remove unneeded fDebug checks in front of LogPrint()/qDebug(), as that
  check is done in LogPrintf() when category is != NULL (true for all
  LogPrint() calls
- remove fDebug ONLY in code which is NOT performance-critical
- harmonize addrman category name
- deprecate -debugnet usage, should be used via -debug=net and remove the
  corresponding global

Conflicts:
	src/init.cpp
	src/qt/paymentrequestplus.cpp
	src/qt/paymentserver.cpp
Fix infinite loop with LogPrint on Windows

Running -printtodebugger -debug (or -debug=lock),
compiled with -DDEBUG_LOCKORDER would infinite loop
on Windows because every critical section lock/unlock
triggers a LogPrint.

Solution is to use the raw boost mutex instead of a CCriticalSection.
Use thread-local storage for LogPrint(category...)

This prevents crashes at shutdown where a global destructor
calls LogPrint(category...) after mapMultiArgs has been
deleted.
Typesafe strprintf/error/LogPrint functions

Switch to tinyformat-based formatting.

Tinyformat is a typesafe drop-in replacement for C99 printf functions:
https://github.com/c42f/tinyformat

Conflicts:
	configure.ac
	src/Makefile.am
	src/util.cpp
	src/util.h
Re-add newline to error() messages

As reported by @Subo1978, error messages don't have a trailing newline
anymore after commit b77dfdc9. Add back this newline.
remove all print() methods
Remove redundant .c_str()s

After the tinyformat switch sprintf() family functions support passing
actual std::string objects.

Remove unnecessary c_str calls (236 of them) in logging and formatting.

Conflicts:
	src/alert.cpp
	src/bitcoinrpc.cpp
	src/core.cpp
	src/db.cpp
	src/init.cpp
	src/leveldbwrapper.cpp
	src/main.cpp
	src/miner.cpp
	src/net.cpp
	src/netbase.cpp
	src/noui.cpp
	src/protocol.cpp
	src/qt/bitcoin.cpp
	src/rpcdump.cpp
	src/rpcmisc.cpp
	src/rpcprotocol.cpp
	src/sync.cpp
	src/txdb.cpp
	src/util.cpp
	src/wallet.cpp
	src/walletdb.cpp
remove other redundant .c_str()s
don't use C99 PRI literals
Make tinyformat errors raise an exception instead of assert()ing

By default tinyformat errors such as 'wrong number of conversion
specifiers in format string' cause an assertion failure.

Raise an exception instead so that error handling can recover or can
show an appropriate error.
Move strprintf define to tinyformat.h

This avoids a dependency on util.h if just tinyformat is needed.

Conflicts:
	src/core.cpp