Debian Codegraph @

ansible_collections/dellemc/openmanage/plugins/module_utils/logging_handler.py

raw symbols SCIP
1 # Copyright: (c) 2025, Dell Technologies
2
3 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
4
5 """Custom rotating file handler for OpenManage"""
6
7 from __future__ import (absolute_import, division, print_function)
8 __metaclass__ = type
9
10 from datetime import datetime
11 from logging.handlers import RotatingFileHandler
12
13
14 class CustomRotatingFileHandler(RotatingFileHandler):
15 def rotation_filename(self, default_name):
16 """
17 Modify the filename of a log file when rotating.
18 :param default_name: The default name of the log file.
19 """
20 src_file_name = default_name.split('.')
21 dest_file_name = "{0}_{1}.{2}.{3}".format(
22 src_file_name[0], '{0:%Y%m%d}'.format(datetime.now()),
23 src_file_name[1], src_file_name[2]
24 )
25 return dest_file_name