Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: base/mac/mac_logging.mm

Issue 1753523002: Use a non-deprecated method to get a string from an OSStatus error . (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/mac/mac_logging.cc ('k') | media/audio/mac/audio_low_latency_input_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/mac/mac_logging.h" 5 #include "base/mac/mac_logging.h"
6 #include "build/build_config.h" 6
7 #import <Foundation/Foundation.h>
7 8
8 #include <iomanip> 9 #include <iomanip>
9 10
11 #include "build/build_config.h"
12
10 #if !defined(OS_IOS) 13 #if !defined(OS_IOS)
11 #include <CoreServices/CoreServices.h> 14 #include <CoreServices/CoreServices.h>
12 #endif 15 #endif
13 16
14 namespace logging { 17 namespace logging {
15 18
19 std::string DescriptionFromOSStatus(OSStatus err) {
20 NSError* error =
21 [NSError errorWithDomain:NSOSStatusErrorDomain code:err userInfo:nil];
22 return error.description.UTF8String;
Mark Mentovai 2016/03/01 15:27:23 Is the full -description what we want, or do we wa
erikchen 2016/03/01 18:02:00 We want -description. -description: Error Domain=
23 }
24
16 OSStatusLogMessage::OSStatusLogMessage(const char* file_path, 25 OSStatusLogMessage::OSStatusLogMessage(const char* file_path,
17 int line, 26 int line,
18 LogSeverity severity, 27 LogSeverity severity,
19 OSStatus status) 28 OSStatus status)
20 : LogMessage(file_path, line, severity), 29 : LogMessage(file_path, line, severity),
21 status_(status) { 30 status_(status) {
22 } 31 }
23 32
24 OSStatusLogMessage::~OSStatusLogMessage() { 33 OSStatusLogMessage::~OSStatusLogMessage() {
25 #if defined(OS_IOS) 34 #if defined(OS_IOS)
26 // TODO(ios): Consider using NSError with NSOSStatusErrorDomain to try to 35 // TODO(ios): Consider using NSError with NSOSStatusErrorDomain to try to
27 // get a description of the failure. 36 // get a description of the failure.
28 stream() << ": " << status_; 37 stream() << ": " << status_;
29 #else 38 #else
30 stream() << ": " 39 stream() << ": "
31 << GetMacOSStatusErrorString(status_) 40 << DescriptionFromOSStatus(status_)
32 << " (" 41 << " ("
33 << status_ 42 << status_
34 << ")"; 43 << ")";
35 #endif 44 #endif
36 } 45 }
37 46
38 } // namespace logging 47 } // namespace logging
OLDNEW
« no previous file with comments | « base/mac/mac_logging.cc ('k') | media/audio/mac/audio_low_latency_input_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698