| // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #include "base/mac/mac_logging.h" |
| #import <Foundation/Foundation.h> |
| #include "build/build_config.h" |
| #include <CoreServices/CoreServices.h> |
| std::string DescriptionFromOSStatus(OSStatus err) { |
| [NSError errorWithDomain:NSOSStatusErrorDomain code:err userInfo:nil]; |
| return error.description.UTF8String; |
| OSStatusLogMessage::OSStatusLogMessage(const char* file_path, |
| : LogMessage(file_path, line, severity), |
| OSStatusLogMessage::~OSStatusLogMessage() { |
| // TODO(crbug.com/546375): Consider using NSError with NSOSStatusErrorDomain |
| // to try to get a description of the failure. |
| stream() << ": " << status_; |
| << DescriptionFromOSStatus(status_) |