X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FBasics%2FlibSALOMELog.cxx;h=ece092484d89653823d2016f4036de5b63023789;hb=d1070d09cfbba6d9b72d8f2ca8d07d23f296686c;hp=6c0cd55a85f63e512a8b59338901314a594b2d5c;hpb=461f7bd0f18eda1bf99df8598c12b967f302c479;p=modules%2Fkernel.git diff --git a/src/Basics/libSALOMELog.cxx b/src/Basics/libSALOMELog.cxx index 6c0cd55a8..ece092484 100644 --- a/src/Basics/libSALOMELog.cxx +++ b/src/Basics/libSALOMELog.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE +// Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -28,6 +28,10 @@ #include #include +#include +#include +#include + enum class VerbosityMode { undefined, nolog, withlog }; static VerbosityMode isActivated = VerbosityMode::undefined; @@ -146,7 +150,7 @@ namespace SALOME return verbosityLevel; } - void BASICS_EXPORT SetVerbosityLevel(VerbosityLevelType level) + void SetVerbosityLevel(VerbosityLevelType level) { verbosityLevel = level; } @@ -156,6 +160,11 @@ namespace SALOME verbosityLevel = FromStrToVerbosityLevel(level); } + std::vector GetAllVerbosityLevelPossibilitiesStr() + { + return {ERROR_LEVEL_VALUE_STR,WARNING_LEVEL_VALUE_STR,INFO_LEVEL_VALUE_STR,DEBUG_LEVEL_VALUE_STR}; + } + std::string VerbosityLevelStr() { return FromVerbosityLevelToStr( VerbosityLevel() ); @@ -180,4 +189,16 @@ namespace SALOME { return VerbosityLevel() >= VerbosityLevelType::error_level; } + + void AppendTimeClock(std::ostream& os) + { + auto now = std::chrono::system_clock::now(); + auto duration = now.time_since_epoch(); + auto timestamp = std::chrono::system_clock::to_time_t(now); + std::tm *local_time = std::localtime(×tamp); + auto millis = std::chrono::duration_cast(duration).count(); + os << std::setfill('0') << std::setw(2) << local_time->tm_hour << ":" + << std::setw(2) << local_time->tm_min << ":" + << std::setw(2) << local_time->tm_sec << "." << std::setw(3) << millis % 1000 << " - "; + } }