3 # Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
5 # This program and the accompanying materials are licensed and made available
6 # under the terms and conditions of the BSD License which accompanies this
7 # distribution. The full text of the license may be found at
8 # http://opensource.org/licenses/bsd-license.php
10 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 return logging
.getLogger('edk')
18 class EdkException(Exception):
19 def __init__(self
, message
, fName
=None, fNo
=None):
20 self
._message
= message
21 ErrorMsg(message
, fName
, fNo
)
24 return '[EDK Failure]: %s' %self
._message
26 def ErrorMsg(mess
, fName
=None, fNo
=None):
27 GetEdkLogger().error(NormalMessage('#ERR#', mess
, fName
, fNo
))
29 def LogMsg(mess
, fName
=None, fNo
=None):
30 GetEdkLogger().info(NormalMessage('@LOG@', mess
, fName
, fNo
))
32 def WarnMsg(mess
, fName
=None, fNo
=None):
33 GetEdkLogger().warning(NormalMessage('!WAR!', mess
, fName
, fNo
))
35 def NormalMessage(type, mess
, fName
=None, fNo
=None):
39 strMsg
+= ' %s' % fName
.replace('/', '\\')
41 strMsg
+= '(%d):' % fNo
45 if fName
is None and fNo
is None: