Adbase
Adinf C++ base library V2
|
adbase 日志处理工具库(使用方法见该模块的描述信息) More...
Namespaces | |
adbase::detail | |
Classes | |
class | adbase::AsyncLogging |
class | adbase::LogFile |
class | adbase::Logger |
class | adbase::LogStream |
class | adbase::Fmt |
Macros | |
#define | LOG_TRACE |
#define | LOG_DEBUG |
#define | LOG_INFO |
#define | LOG_WARN adbase::Logger(__FILE__, __LINE__, adbase::Logger::WARN).stream() |
#define | LOG_ERROR adbase::Logger(__FILE__, __LINE__, adbase::Logger::ERROR).stream() |
#define | LOG_FATAL adbase::Logger(__FILE__, __LINE__, adbase::Logger::FATAL).stream() |
#define | LOG_SYSERR adbase::Logger(__FILE__, __LINE__, false).stream() |
#define | LOG_SYSFATAL adbase::Logger(__FILE__, __LINE__, true).stream() |
#define | CHECK_NOTNULL(val) ::adbase::CheckNotNull(__FILE__, __LINE__, "'" #val "' Must be non NULL", (val)) |
Functions | |
const char * | adbase::strerror_tl (int saveErrno) |
template<typename T > | |
T * | adbase::CheckNotNull (Logger::SourceFile file, int line, const char *names, T *ptr) |
LogStream & | adbase::operator<< (LogStream &s, const Fmt &fmt) |
static LogLevel | adbase::Logger::logLevel () |
Variables | |
Logger::LogLevel | adbase::gLogLevel = initLogLevel() |
adbase 日志处理工具库(使用方法见该模块的描述信息)
日志写入是分日志等级通过宏替换来做,分为 TRACE, DEBUG, INFO, WARN, ERROR, FATAL, SYSERR, SYSFATAL
通过 LOG_* 方式写入
默认是 INFO 级别,如果需要修改系统 LOG 级别可以通过两种方式修改
日志落地通过 setOutput回调函数来决定落地方式,默认是写入到 stdout 中, 日志库还提供了一种异步写入到文件的落地方式
#define CHECK_NOTNULL | ( | val | ) | ::adbase::CheckNotNull(__FILE__, __LINE__, "'" #val "' Must be non NULL", (val)) |
Definition at line 122 of file Logging.hpp.
#define LOG_DEBUG |
Definition at line 110 of file Logging.hpp.
Referenced by adbase::detail::acceptHandler(), adbase::Acceptor::acceptHandler(), adbase::Acceptor::Acceptor(), adbase::TcpConnection::eventCallback(), adbase::Connector::handleError(), adbase::mc::ClientHandler::onConnection(), adbase::mc::ClientHandler::onMessage(), adbase::head::Handler::onMessage(), adbase::mc::Handler::onMessage(), adbase::detail::pipeHandler(), adbase::mc::Ascii::processData(), adbase::head::Binary::processData(), adbase::mc::Binary::processData(), adbase::http::Server::registerLocation(), adbase::TcpWorker::removeConnection(), adbase::http::Server::Server(), adbase::TcpConnection::shutdown(), adbase::TcpServer::start(), adbase::http::Server::start(), adbase::http::Server::threadFunc(), adbase::TcpConnection::writeCallback(), adbase::Socket::~Socket(), and adbase::TimerItem::~TimerItem().
#define LOG_ERROR adbase::Logger(__FILE__, __LINE__, adbase::Logger::ERROR).stream() |
Definition at line 115 of file Logging.hpp.
Referenced by adbase::detail::acceptHandler(), adbase::Acceptor::acceptHandler(), adbase::kafka::Consumer::deleteThread(), adbase::TcpServer::deleteThread(), adbase::http::Server::deleteThread(), adbase::kafka::Producer::deliveredCallback(), adbase::TcpConnection::eventCallback(), adbase::mc::ClientHandler::get(), adbase::Connector::handleError(), adbase::EventLoop::isStop(), adbase::TcpServer::newConnection(), adbase::detail::pipeHandler(), adbase::http::detail::pipeHandler(), adbase::TcpWorker::pipeHandler(), adbase::head::Binary::processData(), adbase::mc::Binary::processData(), adbase::kafka::Consumer::rebalanceCallback(), adbase::TcpConnection::send(), adbase::Socket::setReusePort(), adbase::EventLoop::stop(), adbase::TcpServer::stop(), adbase::kafka::Consumer::stop(), adbase::http::Server::stop(), adbase::kafka::Producer::stop(), adbase::kafka::Consumer::threadFunc(), adbase::kafka::Producer::threadFunc(), and adbase::http::Server::threadFunc().
#define LOG_FATAL adbase::Logger(__FILE__, __LINE__, adbase::Logger::FATAL).stream() |
Definition at line 116 of file Logging.hpp.
Referenced by adbase::sockets::accept(), adbase::mc::Ascii::processData(), adbase::TcpWorker::start(), adbase::TcpServer::start(), adbase::http::Server::start(), and adbase::http::Server::threadFunc().
#define LOG_INFO |
Definition at line 112 of file Logging.hpp.
Referenced by adbase::TcpClient::connect(), adbase::Connector::handleError(), adbase::kafka::Consumer::rebalanceCallback(), adbase::http::Server::registerLocation(), adbase::http::Response::sendReply(), adbase::TcpClient::stop(), adbase::kafka::Producer::stop(), adbase::TcpClient::TcpClient(), adbase::kafka::Consumer::threadFunc(), adbase::kafka::Producer::threadFunc(), adbase::Connector::~Connector(), and adbase::TcpClient::~TcpClient().
#define LOG_SYSERR adbase::Logger(__FILE__, __LINE__, false).stream() |
Definition at line 117 of file Logging.hpp.
Referenced by adbase::sockets::accept(), adbase::sockets::close(), adbase::sockets::fromIpPort(), adbase::sockets::getLocalAddr(), adbase::sockets::getPeerAddr(), adbase::InetAddress::resolve(), adbase::InetAddress::resolveAll(), adbase::Connector::restart(), adbase::Socket::setReusePort(), and adbase::sockets::shutdownWrite().
#define LOG_SYSFATAL adbase::Logger(__FILE__, __LINE__, true).stream() |
Definition at line 118 of file Logging.hpp.
Referenced by adbase::sockets::bindOrDie(), adbase::sockets::createNonblockingOrDie(), and adbase::sockets::listenOrDie().
#define LOG_TRACE |
Definition at line 108 of file Logging.hpp.
Referenced by adbase::Connector::Connector(), adbase::detail::defaultConnectionCallback(), adbase::kafka::Producer::deliveredCallback(), adbase::TcpConnection::eventCallback(), adbase::mc::ClientHandler::get(), adbase::Connector::handleError(), adbase::Connector::handleWrite(), adbase::head::Handler::onClose(), adbase::mc::ClientHandler::onConnection(), adbase::head::Handler::onConnection(), adbase::mc::Handler::onConnection(), adbase::TcpWorker::pipeHandler(), adbase::head::Binary::processData(), adbase::mc::Binary::processData(), adbase::TcpConnection::readCallback(), adbase::Connector::restart(), adbase::TcpWorker::start(), adbase::kafka::Consumer::threadFunc(), adbase::kafka::Producer::threadFunc(), adbase::http::Server::threadFunc(), adbase::TcpConnection::writeCallback(), and adbase::TcpConnection::~TcpConnection().
#define LOG_WARN adbase::Logger(__FILE__, __LINE__, adbase::Logger::WARN).stream() |
Definition at line 114 of file Logging.hpp.
Referenced by adbase::Connector::handleWrite(), and adbase::http::Server::onRequestCallback().
T* adbase::CheckNotNull | ( | Logger::SourceFile | file, |
int | line, | ||
const char * | names, | ||
T * | ptr | ||
) |
Definition at line 126 of file Logging.hpp.
References adbase::Logger::FATAL, and adbase::Logger::Logger().
|
inlinestatic |
Definition at line 104 of file Logging.hpp.
References adbase::gLogLevel.
Referenced by adbase::Logger::stream().
Definition at line 203 of file LogStream.hpp.
References adbase::LogStream::append(), adbase::Fmt::data(), and adbase::Fmt::length().
const char * adbase::strerror_tl | ( | int | saveErrno | ) |
Definition at line 17 of file Logging.cpp.
Referenced by adbase::Connector::handleError(), and adbase::Connector::handleWrite().
Logger::LogLevel adbase::gLogLevel = initLogLevel() |
Definition at line 31 of file Logging.cpp.
Referenced by adbase::Logger::logLevel().