Add ICU message format support
[chromium-blink-merge.git] / chrome / common / media / webrtc_logging_message_data.cc
blobf1e8395da40f9dd7d450181f3a63e74bce376001
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/common/media/webrtc_logging_message_data.h"
7 #include "base/strings/stringprintf.h"
9 WebRtcLoggingMessageData::WebRtcLoggingMessageData() {}
11 WebRtcLoggingMessageData::WebRtcLoggingMessageData(base::Time time,
12 const std::string& message)
13 : timestamp(time), message(message) {}
15 std::string
16 WebRtcLoggingMessageData::Format(base::Time start_time) const {
17 int32 interval_ms =
18 static_cast<int32>((timestamp - start_time).InMilliseconds());
20 std::string result = base::StringPrintf("[%03d:%03d] %s",
21 interval_ms / 1000,
22 interval_ms % 1000,
23 message.c_str());
24 return result;