Skip to content

Commit

Permalink
chg: [wifisecurity] time based output
Browse files Browse the repository at this point in the history
  • Loading branch information
cvandeplas committed Dec 5, 2024
1 parent 5156d80 commit 3066d2b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/sysdiagnose/parsers/wifisecurity.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@

import os
from sysdiagnose.utils.base import BaseParserInterface, logger
from datetime import datetime


class WifiSecurityParser(BaseParserInterface):
description = "Parsing WiFi Security logs"
format = "jsonl"

def __init__(self, config: dict, case_id: str):
super().__init__(__file__, config, case_id)
Expand Down Expand Up @@ -56,6 +58,9 @@ def parse_file(path: str) -> list | dict:
logger.debug(f"key: {key.strip()}, value: {value.strip()}")
element[key.strip()] = value.strip()
elif element:
timestamp = datetime.strptime(element['mdat'], "%Y-%m-%d %H:%M:%S %z")
element['datetime'] = timestamp.isoformat(timespec='microseconds')
element['timestamp'] = timestamp.timestamp()
entries.append(element)
logger.debug(f"appending {element}")
element = {}
Expand Down

0 comments on commit 3066d2b

Please sign in to comment.