48 gcroot<String^> m_pFormatString;
49 gcroot<ILog^> m_pLogger;
53 static void Configure()
62 NPT_LogManager::GetDefault().Configure(
"plist:.level=ALL;.handlers=;platinum.level=ALL;platinum.handlers=");
65 NPT_Logger* rootLogger = NPT_LogManager::GetLogger(
"platinum");
70 rootLogger->AddHandler(&instance,
false);
80 gcroot<ILog^> log = SetLoggerName(record.m_LoggerName);
82 switch (record.m_Level)
84 case NPT_LOG_LEVEL_FATAL:
85 if (log->IsFatalEnabled)
89 marshal_as<String^>(NPT_Log::GetLogLevelName(record.m_Level)),
90 marshal_as<String^>(record.m_Message),
91 marshal_as<String^>(record.m_SourceFile),
92 UInt32(record.m_SourceLine)
98 case NPT_LOG_LEVEL_SEVERE:
99 if (log->IsErrorEnabled)
103 marshal_as<String^>(NPT_Log::GetLogLevelName(record.m_Level)),
104 marshal_as<String^>(record.m_Message),
105 marshal_as<String^>(record.m_SourceFile),
106 UInt32(record.m_SourceLine)
112 case NPT_LOG_LEVEL_WARNING:
113 if (log->IsWarnEnabled)
117 marshal_as<String^>(NPT_Log::GetLogLevelName(record.m_Level)),
118 marshal_as<String^>(record.m_Message),
119 marshal_as<String^>(record.m_SourceFile),
120 UInt32(record.m_SourceLine)
126 case NPT_LOG_LEVEL_INFO:
127 if (log->IsInfoEnabled)
131 marshal_as<String^>(NPT_Log::GetLogLevelName(record.m_Level)),
132 marshal_as<String^>(record.m_Message),
133 marshal_as<String^>(record.m_SourceFile),
134 UInt32(record.m_SourceLine)
140 case NPT_LOG_LEVEL_FINE:
141 case NPT_LOG_LEVEL_FINER:
142 case NPT_LOG_LEVEL_FINEST:
143 if (log->IsDebugEnabled)
147 marshal_as<String^>(NPT_Log::GetLogLevelName(record.m_Level)),
148 marshal_as<String^>(record.m_Message),
149 marshal_as<String^>(record.m_SourceFile),
150 UInt32(record.m_SourceLine)
157 if (log->IsWarnEnabled)
161 marshal_as<String^>(
"UNKNOWN_LOG_LEVEL"),
162 marshal_as<String^>(record.m_Message),
163 marshal_as<String^>(record.m_SourceFile),
164 UInt32(record.m_SourceLine)
174 gcroot<ILog^> SetLoggerName(
const char* name)
176 m_SetLoggerNameLock.Lock();
178 gcroot<String^> loggerName =
gcnew String(name);
179 gcroot<ILog^> logger = m_pLogger;
181 if (logger->Logger->Name != loggerName)
183 logger = LogManager::GetLogger(loggerName);
188 m_SetLoggerNameLock.Unlock();
197 m_pLogger = LogManager::GetLogger(
gcnew String(
"NeptuneLoggingBridge"));
198 m_pFormatString =
gcnew String(
"{0}: {2}:{3}: {1}");
Definition: NptThreads.h:76
Definition: NptLogging.h:70
Definition: addon_base.h:267
Definition: NeptuneLoggingBridge.h:43
Definition: NptLogging.h:86
Definition: NptLogging.h:58