82 #ifndef TEAMCENTER_LOGGING_LOGGER_HXX
83 #define TEAMCENTER_LOGGING_LOGGER_HXX
88 #include <string_view>
89 #include <common/tc_deprecation_macros.h>
91 #include <mld/libmld_exports.h>
94 #define APPENDER_SYSLOG_STR "syslog"
95 #define APPENDER_STDOUT_STR "stdout"
96 #define APPENDER_STDERR_STR "stderr"
105 friend class LoggerTree;
111 enum level{LOG_TRACE=1,LOG_DEBUG=2,LOG_INFO=3,LOG_WARN=4,LOG_ERROR=5,LOG_FATAL=6,LOG_NOTE=7,LOG_OFF=8};
116 enum appender{APPENDER_SYSLOG=0, APPENDER_STDOUT=1, APPENDER_STDERR=2};
130 void setLogLevel(level lvl);
184 void fatal(
const std::string &msg) { log(LOG_FATAL, msg); };
192 void fatal(
const int errorCode,
const std::string &msg) { log(LOG_FATAL, errorCode, msg); };
202 void fatal(
const char* file,
const int line,
const int errorCode,
const std::string &msg) { log(LOG_FATAL, file, line, errorCode, msg); };
214 void fatal(
const char* file,
const int line,
const int errorCode,
const char* control_string, ... );
221 void error(
const std::string &msg) { log(LOG_ERROR, msg); };
229 void error(
const int errorCode,
const std::string &msg) { log(LOG_ERROR, errorCode, msg); };
240 void error(
const char* file,
const int line,
const int errorCode,
const std::string &msg) { log(LOG_ERROR, file, line, errorCode, msg); };
251 void error(
const char* file,
const int line,
const int errorCode,
const char* control_string, ... );
258 void warn(
const std::string &msg) { log(LOG_WARN, msg); };
266 void warn(
const int errorCode,
const std::string &msg) { log(LOG_WARN, errorCode, msg); };
276 void warn (
const char* file,
const int line,
const int errorCode,
const std::string &msg) { log(LOG_WARN, file, line, errorCode, msg); };
288 void warn(
const char* file,
const int line,
const int errorCode,
const char* control_string, ... );
295 void info(
const std::string &msg) { log(LOG_INFO, msg); };
304 void info (
const char* file,
const int line,
const std::string &msg) { log(LOG_INFO, file, line, msg); };
314 void info (
const char* file,
const int line,
const int errorCode,
const std::string &msg) { log(LOG_INFO, file, line, errorCode, msg); };
325 void info(
const char* file,
const int line,
const char *control_string, ... );
332 void debug(
const std::string &msg) { log(LOG_DEBUG, msg); };
340 void debug(
const int errorCode,
const std::string& msg ) { log( LOG_DEBUG, errorCode, msg ); };
349 void debug(
const char* file,
const int line,
const std::string &msg) { log(LOG_DEBUG, file, line, msg); };
359 void debug (
const char* file,
const int line,
const int errorCode,
const std::string &msg) { log(LOG_DEBUG, file, line, errorCode, msg); };
370 void debug(
const char* file,
const int line,
const char* control_string, ... );
382 void debug(
const char* file,
const int line,
const int errorCode,
const char* control_string, ... );
388 void trace(
const std::string &msg) { log(LOG_TRACE, msg); };
397 void trace(
const char* file,
const int line,
const std::string &msg) { log(LOG_TRACE, file, line, msg); };
407 void trace (
const char* file,
const int line,
const int errorCode,
const std::string &msg) { log(LOG_TRACE, file, line, errorCode, msg); };
418 void trace(
const char* file,
const int line,
const char *control_string, ... );
430 TC_DEPRECATED_NO_REPLACEMENT(
"11.4",
"Teamcenter::Logging::Logger::note" )
431 void note(const std::
string &msg) { log(LOG_NOTE, msg); };
447 TC_DEPRECATED_NO_REPLACEMENT(
"11.4",
"Teamcenter::Logging::Logger::note" )
448 void note( const
char* file, const
int line, const
char *control_string, ... );
457 void log( const
Logger::level lvl, const std::
string& msg );
467 void log( const
Logger::level lvl, const std::
string errorCode, const std::
string& msg );
477 void log( const
Logger::level lvl, const
int errorCode, const std::
string& msg );
491 void log( const
Logger::level lvl, const
char* file, const
int line, const
int errorCode, const std::
string& msg );
504 void log ( const
Logger::level lvl, const
char *file, const
int line, const std::
string& msg);
517 void logNoStackTrace ( const
Logger::level lvl, const
char *file, const
int line, const
int errorCode, const std::
string &msg);
526 bool isEnabled (const
Logger::
level lvl)
const {
return ( lvl >= logLevel ); };
535 static Logger* getLogger(
const std::string &key);
545 void logf(
const Logger::level lvl,
const int errorCode,
const char *control_string, ... ) ;
557 void logf(
const Logger::level lvl,
const char *file,
const int line,
const int errorCode,
const char *control_string, ... );
567 void printf(
const Logger::level lvl,
const char *control_string, ... );
576 void printf(
const char *control_string, ... );
583 void printString( std::string_view str )
const;
590 static Logger* getLoggerObject(
const std::string &key);
596 static std::vector<Logger *> getListOfLoggers(std::string key);
607 void setLogLevelInheritance (
bool isInherited);
617 void logAlways(
const Logger::level lvl,
int errorCode, std::string_view msg );
631 void logAlways(
const Logger::level lvl,
const char* file,
const int line,
const int errorCode, std::string_view msg );
666 explicit Logger(
const std::string &name);
681 std::string getTime()
const;
688 std::string formatLogEntry (
const Logger::level lvl,
const std::string_view errCode )
const;
689 std::string formatLogEntry (
const Logger::level lvl )
const;
690 std::string formatLogEntry(
const Logger::level lvl,
const int errCode,
bool includLoggerName )
const;
695 FILE* getLogFilePointer()
const;
700 void writeToLogAndPublish(
const std::string& str );
711 bool isErrorSuppression(
const Logger::level lvl,
const int errorCode);
719 void processErrorSuppressionAndLog( std::string& logLine );
725 void appendFileAndLine(std::string &str,
const char* file,
const int line)
const;
744 std::string substituteForInvalidArgs (
const char* control_string, va_list ap1 );
755 int checkForNullPointer (
const char* control_string, va_list ap1);
760 void logv(
const Logger::level lvl,
const char* file,
const int line,
const int errorCode,
const char* control_string, std::va_list va );
778 void appendFileNameForCentralizedLogging(std::string &str)
const;
785 static std::string getLeafName(std::string absolutePath );
790 #include <mld/libmld_undef.h>