1 // Copyright 2017 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "partition_alloc/partition_alloc_base/fuchsia/fuchsia_logging.h"
6
7 #include <zircon/status.h>
8
9 #include <iomanip>
10
11 namespace partition_alloc::internal::logging {
12
ZxLogMessage(const char * file_path,int line,LogSeverity severity,zx_status_t zx_err)13 ZxLogMessage::ZxLogMessage(const char* file_path,
14 int line,
15 LogSeverity severity,
16 zx_status_t zx_err)
17 : LogMessage(file_path, line, severity), zx_err_(zx_err) {}
18
~ZxLogMessage()19 ZxLogMessage::~ZxLogMessage() {
20 // zx_status_t error values are negative, so log the numeric version as
21 // decimal rather than hex. This is also useful to match zircon/errors.h for
22 // grepping.
23 stream() << ": " << zx_status_get_string(zx_err_) << " (" << zx_err_ << ")";
24 }
25
26 } // namespace partition_alloc::internal::logging
27