📄 logger.cpp
字号:
void Logger::l7dlog(const LevelPtr& level1, const std::string& key,
const LocationInfo& location,
const std::string& val1, const std::string& val2, const std::string& val3) const {
LOG4CXX_DECODE_CHAR(lkey, key);
LOG4CXX_DECODE_CHAR(lval1, val1);
LOG4CXX_DECODE_CHAR(lval2, val2);
LOG4CXX_DECODE_CHAR(lval3, val3);
std::vector<LogString> values(3);
values[0] = lval1;
values[1] = lval2;
values[2] = lval3;
l7dlog(level1, lkey, location, values);
}
void Logger::removeAllAppenders()
{
synchronized sync(mutex);
if(aai != 0)
{
aai->removeAllAppenders();
aai = 0;
}
}
void Logger::removeAppender(const AppenderPtr& appender)
{
synchronized sync(mutex);
if(appender == 0 || aai == 0)
{
return;
}
aai->removeAppender(appender);
}
void Logger::removeAppender(const LogString& name1)
{
synchronized sync(mutex);
if(name1.empty() || aai == 0)
{
return;
}
aai->removeAppender(name1);
}
void Logger::setAdditivity(bool additive1)
{
synchronized sync(mutex);
this->additive = additive1;
}
void Logger::setHierarchy(spi::LoggerRepository * repository1)
{
this->repository = repository1;
}
void Logger::setLevel(const LevelPtr& level1)
{
this->level = level1;
}
LoggerPtr Logger::getLogger(const std::string& name)
{
return LogManager::getLogger(name);
}
LoggerPtr Logger::getLogger(const char* const name)
{
return LogManager::getLogger(name);
}
LoggerPtr Logger::getRootLogger() {
return LogManager::getRootLogger();
}
LoggerPtr Logger::getLoggerLS(const LogString& name,
const spi::LoggerFactoryPtr& factory)
{
return LogManager::getLoggerLS(name, factory);
}
void Logger::getName(std::string& rv) const {
Transcoder::encode(name, rv);
}
void Logger::trace(const std::string& msg, const log4cxx::spi::LocationInfo& location) const {
if (isTraceEnabled()) {
forcedLog(log4cxx::Level::getTrace(), msg, location);
}
}
void Logger::trace(const std::string& msg) const {
if (isTraceEnabled()) {
forcedLog(log4cxx::Level::getTrace(), msg);
}
}
void Logger::debug(const std::string& msg, const log4cxx::spi::LocationInfo& location) const {
if (isDebugEnabled()) {
forcedLog(log4cxx::Level::getDebug(), msg, location);
}
}
void Logger::debug(const std::string& msg) const {
if (isDebugEnabled()) {
forcedLog(log4cxx::Level::getDebug(), msg);
}
}
void Logger::error(const std::string& msg, const log4cxx::spi::LocationInfo& location) const {
if (isErrorEnabled()) {
forcedLog(log4cxx::Level::getError(), msg, location);
}
}
void Logger::error(const std::string& msg) const {
if (isErrorEnabled()) {
forcedLog(log4cxx::Level::getError(), msg);
}
}
void Logger::fatal(const std::string& msg, const log4cxx::spi::LocationInfo& location) const {
if (isFatalEnabled()) {
forcedLog(log4cxx::Level::getFatal(), msg, location);
}
}
void Logger::fatal(const std::string& msg) const {
if (isFatalEnabled()) {
forcedLog(log4cxx::Level::getFatal(), msg);
}
}
void Logger::info(const std::string& msg, const log4cxx::spi::LocationInfo& location) const {
if (isInfoEnabled()) {
forcedLog(log4cxx::Level::getInfo(), msg, location);
}
}
void Logger::info(const std::string& msg) const {
if (isInfoEnabled()) {
forcedLog(log4cxx::Level::getInfo(), msg);
}
}
void Logger::log(const LevelPtr& level1, const std::string& message,
const log4cxx::spi::LocationInfo& location) const {
if (isEnabledFor(level1)) {
forcedLog(level1, message, location);
}
}
void Logger::log(const LevelPtr& level1, const std::string& message) const {
if (isEnabledFor(level1)) {
forcedLog(level1, message);
}
}
void Logger::logLS(const LevelPtr& level1, const LogString& message,
const log4cxx::spi::LocationInfo& location) const {
if (isEnabledFor(level1)) {
forcedLogLS(level1, message, location);
}
}
void Logger::warn(const std::string& msg, const log4cxx::spi::LocationInfo& location) const {
if (isWarnEnabled()) {
forcedLog(log4cxx::Level::getWarn(), msg, location);
}
}
void Logger::warn(const std::string& msg) const {
if (isWarnEnabled()) {
forcedLog(log4cxx::Level::getWarn(), msg);
}
}
LoggerPtr Logger::getLoggerLS(const LogString& name) {
return LogManager::getLoggerLS(name);
}
#if LOG4CXX_WCHAR_T_API
void Logger::forcedLog(const LevelPtr& level1, const std::wstring& message,
const LocationInfo& location) const
{
Pool p;
LOG4CXX_DECODE_WCHAR(msg, message);
LoggingEventPtr event(new LoggingEvent(name, level1, msg, location));
callAppenders(event, p);
}
void Logger::forcedLog(const LevelPtr& level1, const std::wstring& message) const
{
Pool p;
LOG4CXX_DECODE_WCHAR(msg, message);
LoggingEventPtr event(new LoggingEvent(name, level1, msg,
LocationInfo::getLocationUnavailable()));
callAppenders(event, p);
}
void Logger::getName(std::wstring& rv) const {
Transcoder::encode(name, rv);
}
LoggerPtr Logger::getLogger(const std::wstring& name)
{
return LogManager::getLogger(name);
}
LoggerPtr Logger::getLogger(const wchar_t* const name)
{
return LogManager::getLogger(name);
}
void Logger::trace(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const {
if (isTraceEnabled()) {
forcedLog(log4cxx::Level::getTrace(), msg, location);
}
}
void Logger::trace(const std::wstring& msg) const {
if (isTraceEnabled()) {
forcedLog(log4cxx::Level::getTrace(), msg);
}
}
void Logger::debug(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const {
if (isDebugEnabled()) {
forcedLog(log4cxx::Level::getDebug(), msg, location);
}
}
void Logger::debug(const std::wstring& msg) const {
if (isDebugEnabled()) {
forcedLog(log4cxx::Level::getDebug(), msg);
}
}
void Logger::error(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const {
if (isErrorEnabled()) {
forcedLog(log4cxx::Level::getError(), msg, location);
}
}
void Logger::error(const std::wstring& msg) const {
if (isErrorEnabled()) {
forcedLog(log4cxx::Level::getError(), msg);
}
}
void Logger::fatal(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const {
if (isFatalEnabled()) {
forcedLog(log4cxx::Level::getFatal(), msg, location);
}
}
void Logger::fatal(const std::wstring& msg) const {
if (isFatalEnabled()) {
forcedLog(log4cxx::Level::getFatal(), msg);
}
}
void Logger::info(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const {
if (isInfoEnabled()) {
forcedLog(log4cxx::Level::getInfo(), msg, location);
}
}
void Logger::info(const std::wstring& msg) const {
if (isInfoEnabled()) {
forcedLog(log4cxx::Level::getInfo(), msg);
}
}
void Logger::log(const LevelPtr& level1, const std::wstring& message,
const log4cxx::spi::LocationInfo& location) const {
if (isEnabledFor(level1)) {
forcedLog(level1, message, location);
}
}
void Logger::log(const LevelPtr& level1, const std::wstring& message) const {
if (isEnabledFor(level1)) {
forcedLog(level1, message);
}
}
void Logger::warn(const std::wstring& msg, const log4cxx::spi::LocationInfo& location) const {
if (isWarnEnabled()) {
forcedLog(log4cxx::Level::getWarn(), msg, location);
}
}
void Logger::warn(const std::wstring& msg) const {
if (isWarnEnabled()) {
forcedLog(log4cxx::Level::getWarn(), msg);
}
}
#endif
#if LOG4CXX_UNICHAR_API || LOG4CXX_CFSTRING_API
void Logger::forcedLog(const LevelPtr& level1, const std::basic_string<UniChar>& message,
const LocationInfo& location) const
{
Pool p;
LOG4CXX_DECODE_UNICHAR(msg, message);
LoggingEventPtr event(new LoggingEvent(name, level1, msg, location));
callAppenders(event, p);
}
void Logger::forcedLog(const LevelPtr& level1, const std::basic_string<UniChar>& message) const
{
Pool p;
LOG4CXX_DECODE_UNICHAR(msg, message);
LoggingEventPtr event(new LoggingEvent(name, level1, msg,
LocationInfo::getLocationUnavailable()));
callAppenders(event, p);
}
#endif
#if LOG4CXX_UNICHAR_API
void Logger::getName(std::basic_string<UniChar>& rv) const {
Transcoder::encode(name, rv);
}
LoggerPtr Logger::getLogger(const std::basic_string<UniChar>& name)
{
return LogManager::getLogger(name);
}
void Logger::trace(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const {
if (isTraceEnabled()) {
forcedLog(log4cxx::Level::getTrace(), msg, location);
}
}
void Logger::trace(const std::basic_string<UniChar>& msg) const {
if (isTraceEnabled()) {
forcedLog(log4cxx::Level::getTrace(), msg);
}
}
void Logger::debug(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const {
if (isDebugEnabled()) {
forcedLog(log4cxx::Level::getDebug(), msg, location);
}
}
void Logger::debug(const std::basic_string<UniChar>& msg) const {
if (isDebugEnabled()) {
forcedLog(log4cxx::Level::getDebug(), msg);
}
}
void Logger::error(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const {
if (isErrorEnabled()) {
forcedLog(log4cxx::Level::getError(), msg, location);
}
}
void Logger::error(const std::basic_string<UniChar>& msg) const {
if (isErrorEnabled()) {
forcedLog(log4cxx::Level::getError(), msg);
}
}
void Logger::fatal(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const {
if (isFatalEnabled()) {
forcedLog(log4cxx::Level::getFatal(), msg, location);
}
}
void Logger::fatal(const std::basic_string<UniChar>& msg) const {
if (isFatalEnabled()) {
forcedLog(log4cxx::Level::getFatal(), msg);
}
}
void Logger::info(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const {
if (isInfoEnabled()) {
forcedLog(log4cxx::Level::getInfo(), msg, location);
}
}
void Logger::info(const std::basic_string<UniChar>& msg) const {
if (isInfoEnabled()) {
forcedLog(log4cxx::Level::getInfo(), msg);
}
}
void Logger::log(const LevelPtr& level1, const std::basic_string<UniChar>& message,
const log4cxx::spi::LocationInfo& location) const {
if (isEnabledFor(level1)) {
forcedLog(level1, message, location);
}
}
void Logger::log(const LevelPtr& level1, const std::basic_string<UniChar>& message) const {
if (isEnabledFor(level1)) {
forcedLog(level1, message);
}
}
void Logger::warn(const std::basic_string<UniChar>& msg, const log4cxx::spi::LocationInfo& location) const {
if (isWarnEnabled()) {
forcedLog(log4cxx::Level::getWarn(), msg, location);
}
}
void Logger::warn(const std::basic_string<UniChar>& msg) const {
if (isWarnEnabled()) {
forcedLog(log4cxx::Level::getWarn(), msg);
}
}
#endif
#if LOG4CXX_CFSTRING_API
void Logger::forcedLog(const LevelPtr& level1, const CFStringRef& message,
const LocationInfo& location) const
{
Pool p;
LOG4CXX_DECODE_CFSTRING(msg, message);
LoggingEventPtr event(new LoggingEvent(name, level1, msg, location));
callAppenders(event, p);
}
void Logger::forcedLog(const LevelPtr& level1, const CFStringRef& message) const
{
Pool p;
LOG4CXX_DECODE_CFSTRING(msg, message);
LoggingEventPtr event(new LoggingEvent(name, level1, msg,
LocationInfo::getLocationUnavailable()));
callAppenders(event, p);
}
void Logger::getName(CFStringRef& rv) const {
rv = Transcoder::encode(name);
}
LoggerPtr Logger::getLogger(const CFStringRef& name)
{
return LogManager::getLogger(name);
}
void Logger::trace(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const {
if (isTraceEnabled()) {
forcedLog(log4cxx::Level::getTrace(), msg, location);
}
}
void Logger::trace(const CFStringRef& msg) const {
if (isTraceEnabled()) {
forcedLog(log4cxx::Level::getTrace(), msg);
}
}
void Logger::debug(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const {
if (isDebugEnabled()) {
forcedLog(log4cxx::Level::getDebug(), msg, location);
}
}
void Logger::debug(const CFStringRef& msg) const {
if (isDebugEnabled()) {
forcedLog(log4cxx::Level::getDebug(), msg);
}
}
void Logger::error(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const {
if (isErrorEnabled()) {
forcedLog(log4cxx::Level::getError(), msg, location);
}
}
void Logger::error(const CFStringRef& msg) const {
if (isErrorEnabled()) {
forcedLog(log4cxx::Level::getError(), msg);
}
}
void Logger::fatal(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const {
if (isFatalEnabled()) {
forcedLog(log4cxx::Level::getFatal(), msg, location);
}
}
void Logger::fatal(const CFStringRef& msg) const {
if (isFatalEnabled()) {
forcedLog(log4cxx::Level::getFatal(), msg);
}
}
void Logger::info(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const {
if (isInfoEnabled()) {
forcedLog(log4cxx::Level::getInfo(), msg, location);
}
}
void Logger::info(const CFStringRef& msg) const {
if (isInfoEnabled()) {
forcedLog(log4cxx::Level::getInfo(), msg);
}
}
void Logger::log(const LevelPtr& level1, const CFStringRef& message,
const log4cxx::spi::LocationInfo& location) const {
if (isEnabledFor(level1)) {
forcedLog(level1, message, location);
}
}
void Logger::log(const LevelPtr& level1, const CFStringRef& message) const {
if (isEnabledFor(level1)) {
forcedLog(level1, message);
}
}
void Logger::warn(const CFStringRef& msg, const log4cxx::spi::LocationInfo& location) const {
if (isWarnEnabled()) {
forcedLog(log4cxx::Level::getWarn(), msg, location);
}
}
void Logger::warn(const CFStringRef& msg) const {
if (isWarnEnabled()) {
forcedLog(log4cxx::Level::getWarn(), msg);
}
}
char *szBuf = 0;
LOG4CXX_HEX_TRACE(Logger::getLogger("xjLog"),szBuf,2)
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -