Shawn McCarney | 7c5d7b2 | 2020-04-03 18:50:13 -0500 | [diff] [blame] | 1 | /** |
| 2 | * Copyright © 2020 IBM Corporation |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | #pragma once |
| 17 | |
| 18 | #include <string> |
| 19 | |
| 20 | /** |
| 21 | * Systemd journal interface. |
| 22 | * |
Shawn McCarney | 9af8555 | 2020-04-09 11:43:48 -0500 | [diff] [blame] | 23 | * Provides functions to log messages to the systemd journal. |
Shawn McCarney | 7c5d7b2 | 2020-04-03 18:50:13 -0500 | [diff] [blame] | 24 | * |
| 25 | * This interface provides an abstraction layer so that testcases can use a mock |
| 26 | * implementation and validate the logged messages. |
| 27 | * |
| 28 | * This interface does not currently provide the ability to specify key/value |
| 29 | * pairs to provide more information in the journal entry. It will be added |
| 30 | * later if needed. |
| 31 | */ |
| 32 | namespace phosphor::power::regulators::journal |
| 33 | { |
| 34 | |
| 35 | /** |
| 36 | * Logs a message with a priority value of 'ERR' to the systemd journal. |
| 37 | * |
| 38 | * @param message message to log |
| 39 | */ |
| 40 | void logErr(const std::string& message); |
| 41 | |
| 42 | /** |
| 43 | * Logs a message with a priority value of 'INFO' to the systemd journal. |
| 44 | * |
| 45 | * @param message message to log |
| 46 | */ |
| 47 | void logInfo(const std::string& message); |
| 48 | |
Shawn McCarney | 9af8555 | 2020-04-09 11:43:48 -0500 | [diff] [blame] | 49 | /** |
| 50 | * Logs a message with a priority value of 'DEBUG' to the systemd journal. |
| 51 | * |
| 52 | * @param message message to log |
| 53 | */ |
| 54 | void logDebug(const std::string& message); |
| 55 | |
Shawn McCarney | 7c5d7b2 | 2020-04-03 18:50:13 -0500 | [diff] [blame] | 56 | } // namespace phosphor::power::regulators::journal |