1 /** 2 * Copyright © 2019 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 #include "severity.hpp" 17 18 #include "pel_types.hpp" 19 20 namespace openpower 21 { 22 namespace pels 23 { 24 25 using LogSeverity = phosphor::logging::Entry::Level; 26 27 uint8_t convertOBMCSeverityToPEL(LogSeverity severity) 28 { 29 uint8_t pelSeverity = static_cast<uint8_t>(SeverityType::unrecoverable); 30 switch (severity) 31 { 32 case (LogSeverity::Notice): 33 case (LogSeverity::Informational): 34 case (LogSeverity::Debug): 35 pelSeverity = static_cast<uint8_t>(SeverityType::nonError); 36 break; 37 38 case (LogSeverity::Warning): 39 pelSeverity = static_cast<uint8_t>(SeverityType::predictive); 40 break; 41 42 case (LogSeverity::Critical): 43 pelSeverity = static_cast<uint8_t>(SeverityType::critical); 44 break; 45 46 case (LogSeverity::Emergency): 47 case (LogSeverity::Alert): 48 case (LogSeverity::Error): 49 pelSeverity = static_cast<uint8_t>(SeverityType::unrecoverable); 50 break; 51 } 52 53 return pelSeverity; 54 } 55 } // namespace pels 56 } // namespace openpower 57