OLD | NEW |
| (Empty) |
1 // Copyright (c) 2010 The Chromium OS 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. | |
4 | |
5 #include <stdarg.h> | |
6 #include <syslog.h> | |
7 | |
8 #include "crash/system_logging.h" | |
9 | |
10 std::string SystemLoggingImpl::identity_; | |
11 | |
12 SystemLoggingImpl::SystemLoggingImpl() { | |
13 } | |
14 | |
15 SystemLoggingImpl::~SystemLoggingImpl() { | |
16 } | |
17 | |
18 void SystemLoggingImpl::Initialize(const char *ident) { | |
19 // Man page does not specify if openlog copies its string or assumes | |
20 // the pointer is always valid, so make its scope global. | |
21 identity_ = ident; | |
22 openlog(identity_.c_str(), LOG_PID, LOG_USER); | |
23 } | |
24 | |
25 void SystemLoggingImpl::LogInfo(const char *format, ...) { | |
26 va_list vl; | |
27 va_start(vl, format); | |
28 vsyslog(LOG_INFO, format, vl); | |
29 va_end(vl); | |
30 } | |
31 | |
32 void SystemLoggingImpl::LogWarning(const char *format, ...) { | |
33 va_list vl; | |
34 va_start(vl, format); | |
35 vsyslog(LOG_WARNING, format, vl); | |
36 va_end(vl); | |
37 } | |
38 | |
39 void SystemLoggingImpl::LogError(const char *format, ...) { | |
40 va_list vl; | |
41 va_start(vl, format); | |
42 vsyslog(LOG_ERR, format, vl); | |
43 va_end(vl); | |
44 } | |
OLD | NEW |