forked from episodes-platform/shared-snippets
feature/ISEPOS-2280-mechanizm-raportowania-informacji-z-aplikacji-do-pliku-z-logami #1
@ -39,7 +39,7 @@
|
||||
% logger.info('Some info')
|
||||
%
|
||||
% try
|
||||
% error('Simulated error for stack trace logging');
|
||||
% % some code causing exception
|
||||
% catch err
|
||||
% logger.error('An error occurred:', err);
|
||||
% end
|
||||
|
@ -39,7 +39,7 @@
|
||||
% logger.info('Some info')
|
||||
%
|
||||
% try
|
||||
% error('Simulated error for stack trace logging');
|
||||
% % some code causing exception
|
||||
% catch err
|
||||
% logger.error('An error occurred:', err);
|
||||
% end
|
||||
|
@ -43,9 +43,9 @@ def getDefaultLogger(name):
|
||||
logger = getDefaultLogger(__name__)
|
||||
logger.info("This is an info message.")
|
||||
try:
|
||||
raise Exception('Exception for example.')
|
||||
except Exception as e:
|
||||
logger.error('An error occurred:', exc_info=True) # Log with stack trace
|
||||
# some code causing exception
|
||||
except Exception:
|
||||
logger.exception('An error occurred')
|
||||
|
||||
"""
|
||||
logger = logging.getLogger(name)
|
||||
|
Loading…
Reference in New Issue
Block a user