summaryrefslogtreecommitdiffstats
path: root/contrib/Log.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2022-03-29 17:17:58 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2022-03-29 17:17:58 +0200
commit3873a40d9aa8e51560ac18bfbf0c18c1ff7a30dc (patch)
tree20903c97199079ad7ecd7df1d6cc919b19bbd267 /contrib/Log.cpp
parent3c6e2aa8afd108ab9f2d517ef2e2aab96f68c7ef (diff)
downloadODR-AudioEnc-3873a40d9aa8e51560ac18bfbf0c18c1ff7a30dc.tar.gz
ODR-AudioEnc-3873a40d9aa8e51560ac18bfbf0c18c1ff7a30dc.tar.bz2
ODR-AudioEnc-3873a40d9aa8e51560ac18bfbf0c18c1ff7a30dc.zip
Common: log timestamps and socket changes
Diffstat (limited to 'contrib/Log.cpp')
-rw-r--r--contrib/Log.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/contrib/Log.cpp b/contrib/Log.cpp
index abbd69a..089e822 100644
--- a/contrib/Log.cpp
+++ b/contrib/Log.cpp
@@ -25,6 +25,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <iomanip>
#include <list>
#include <cstdarg>
#include <cinttypes>
@@ -119,7 +120,9 @@ void Logger::io_process()
}
if (m.level != log_level_t::trace) {
- std::cerr << levels_as_str[m.level] << " " << message << std::endl;
+ using namespace std::chrono;
+ time_t t = system_clock::to_time_t(system_clock::now());
+ cerr << put_time(std::gmtime(&t), "%Y-%m-%dZ%H:%M:%S") << " " << levels_as_str[m.level] << " " << message << endl;
}
}
}