forked from episodes-platform/shared-snippets
ISEPOS-2280 Adjusted examples of base logger usage
This commit is contained in:
parent
68e32149cc
commit
03616dcac6
@ -39,7 +39,7 @@
|
|||||||
% logger.info('Some info')
|
% logger.info('Some info')
|
||||||
%
|
%
|
||||||
% try
|
% try
|
||||||
% error('Simulated error for stack trace logging');
|
% % some code causing exception
|
||||||
% catch err
|
% catch err
|
||||||
% logger.error('An error occurred:', err);
|
% logger.error('An error occurred:', err);
|
||||||
% end
|
% end
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
% logger.info('Some info')
|
% logger.info('Some info')
|
||||||
%
|
%
|
||||||
% try
|
% try
|
||||||
% error('Simulated error for stack trace logging');
|
% % some code causing exception
|
||||||
% catch err
|
% catch err
|
||||||
% logger.error('An error occurred:', err);
|
% logger.error('An error occurred:', err);
|
||||||
% end
|
% end
|
||||||
|
@ -43,9 +43,9 @@ def getDefaultLogger(name):
|
|||||||
logger = getDefaultLogger(__name__)
|
logger = getDefaultLogger(__name__)
|
||||||
logger.info("This is an info message.")
|
logger.info("This is an info message.")
|
||||||
try:
|
try:
|
||||||
raise Exception('Exception for example.')
|
# some code causing exception
|
||||||
except Exception as e:
|
except Exception:
|
||||||
logger.error('An error occurred:', exc_info=True) # Log with stack trace
|
logger.exception('An error occurred')
|
||||||
|
|
||||||
"""
|
"""
|
||||||
logger = logging.getLogger(name)
|
logger = logging.getLogger(name)
|
||||||
|
Loading…
Reference in New Issue
Block a user