Skip to content

Commit d51351e

Browse files
committed
Adding NONE option for index_name_frequency
1 parent 27ee809 commit d51351e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

cmreslogging/handlers.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class IndexNameFrequency(Enum):
5656
WEEKLY = 1
5757
MONTHLY = 2
5858
YEARLY = 3
59+
NONE = 4
5960

6061
# Defaults for the class
6162
__DEFAULT_ELASTICSEARCH_HOST = [{'host': 'localhost', 'port': 9200}]
@@ -115,11 +116,20 @@ def _get_yearly_index_name(es_index_name):
115116
"""
116117
return "{0!s}-{1!s}".format(es_index_name, datetime.datetime.now().strftime('%Y'))
117118

119+
@staticmethod
120+
def _get_none_index_name(es_index_name):
121+
""" Return elasticsearch index name
122+
:param: index_name the prefix to be used in the index
123+
:return: A srting containing the elasticsearch indexname used which should include the date and specific year
124+
"""
125+
return "{0!s}".format(es_index_name)
126+
118127
_INDEX_FREQUENCY_FUNCION_DICT = {
119128
IndexNameFrequency.DAILY: _get_daily_index_name,
120129
IndexNameFrequency.WEEKLY: _get_weekly_index_name,
121130
IndexNameFrequency.MONTHLY: _get_monthly_index_name,
122-
IndexNameFrequency.YEARLY: _get_yearly_index_name
131+
IndexNameFrequency.YEARLY: _get_yearly_index_name,
132+
IndexNameFrequency.NONE: _get_none_index_name
123133
}
124134

125135
def __init__(self,

0 commit comments

Comments
 (0)