| OLD | NEW |
| 1 // Copyright (c) 2007, Google Inc. | 1 // Copyright (c) 2007, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | 29 |
| 30 // logging.cc: Breakpad logging | 30 // logging.cc: Breakpad logging |
| 31 // | 31 // |
| 32 // See logging.h for documentation. | 32 // See logging.h for documentation. |
| 33 // | 33 // |
| 34 // Author: Mark Mentovai | 34 // Author: Mark Mentovai |
| 35 | 35 |
| 36 #include <assert.h> | 36 #include <assert.h> |
| 37 #include <errno.h> | 37 #include <errno.h> |
| 38 #include <stdio.h> | |
| 39 #include <string.h> | 38 #include <string.h> |
| 40 #include <time.h> | 39 #include <time.h> |
| 41 | 40 |
| 42 #include <string> | 41 #include <string> |
| 43 | 42 |
| 43 #include "common/stdio.h" |
| 44 #include "common/using_std_string.h" | 44 #include "common/using_std_string.h" |
| 45 #include "processor/logging.h" | 45 #include "processor/logging.h" |
| 46 #include "processor/pathname_stripper.h" | 46 #include "processor/pathname_stripper.h" |
| 47 | 47 |
| 48 #ifdef _WIN32 | |
| 49 #define snprintf _snprintf | |
| 50 #endif | |
| 51 | |
| 52 namespace google_breakpad { | 48 namespace google_breakpad { |
| 53 | 49 |
| 54 LogStream::LogStream(std::ostream &stream, Severity severity, | 50 LogStream::LogStream(std::ostream &stream, Severity severity, |
| 55 const char *file, int line) | 51 const char *file, int line) |
| 56 : stream_(stream) { | 52 : stream_(stream) { |
| 57 time_t clock; | 53 time_t clock; |
| 58 time(&clock); | 54 time(&clock); |
| 59 struct tm tm_struct; | 55 struct tm tm_struct; |
| 60 #ifdef _WIN32 | 56 #ifdef _WIN32 |
| 61 localtime_s(&tm_struct, &clock); | 57 localtime_s(&tm_struct, &clock); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 102 |
| 107 // strerror isn't necessarily thread-safe. strerror_r would be preferrable, | 103 // strerror isn't necessarily thread-safe. strerror_r would be preferrable, |
| 108 // but GNU libc uses a nonstandard strerror_r by default, which returns a | 104 // but GNU libc uses a nonstandard strerror_r by default, which returns a |
| 109 // char* (rather than an int success indicator) and doesn't necessarily | 105 // char* (rather than an int success indicator) and doesn't necessarily |
| 110 // use the supplied buffer. | 106 // use the supplied buffer. |
| 111 error_string->assign(strerror(errno)); | 107 error_string->assign(strerror(errno)); |
| 112 return errno; | 108 return errno; |
| 113 } | 109 } |
| 114 | 110 |
| 115 } // namespace google_breakpad | 111 } // namespace google_breakpad |
| OLD | NEW |