2021-04-03 03:54:53 +08:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
#
|
|
|
|
# Copyright (c) 2021 Intel Corporation
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
"""
|
|
|
|
Dictionary-based Logging Parser Module
|
|
|
|
"""
|
|
|
|
|
|
|
|
from .log_parser_v1 import LogParserV1
|
2024-05-17 03:26:22 +08:00
|
|
|
from .log_parser_v3 import LogParserV3
|
2021-04-03 03:54:53 +08:00
|
|
|
|
|
|
|
|
|
|
|
def get_parser(database):
|
|
|
|
"""Get the parser object based on database"""
|
|
|
|
db_ver = int(database.get_version())
|
|
|
|
|
2022-01-13 03:56:05 +08:00
|
|
|
# DB version 1 and 2 correspond to v1 parser
|
|
|
|
if db_ver in [1, 2]:
|
2021-04-03 03:54:53 +08:00
|
|
|
return LogParserV1(database)
|
|
|
|
|
2024-05-17 03:26:22 +08:00
|
|
|
# DB version 3 correspond to v3 parser
|
|
|
|
if db_ver == 3:
|
|
|
|
return LogParserV3(database)
|
|
|
|
|
2021-04-03 03:54:53 +08:00
|
|
|
return None
|