Skip to content

Commit

Permalink
Type fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Mar 20, 2024
1 parent 88fe51f commit 79cd074
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions robotframework_reportportal/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ def log_free_memory(self):
},
)
"""
from typing import Literal, Optional, Dict
from typing import Optional, Dict

from robot.api import logger

from .model import LogMessage


def write(msg: str, level: logger.LOGLEVEL = 'INFO', html: bool = False, attachment: Optional[Dict[str, str]] = None,
launch_log: bool = False):
def write(msg: str, level: str = 'INFO', html: bool = False, attachment: Optional[Dict[str, str]] = None,
launch_log: bool = False) -> None:
"""Write the message to the log file using the given level.
Valid log levels are ``TRACE``, ``DEBUG``, ``INFO`` (default since RF 2.9.1), ``WARN``,
Expand All @@ -68,18 +68,18 @@ def write(msg: str, level: logger.LOGLEVEL = 'INFO', html: bool = False, attachm
logger.write(log_message, level, html)


def trace(msg, html=False, attachment=None, launch_log=False):
def trace(msg: str, html: bool = False, attachment: Optional[Dict[str, str]] = None, launch_log: bool = False) -> None:
"""Write the message to the log file using the ``TRACE`` level."""
write(msg, "TRACE", html, attachment, launch_log)


def debug(msg, html=False, attachment=None, launch_log=False):
def debug(msg: str, html: bool = False, attachment: Optional[Dict[str, str]] = None, launch_log: bool = False) -> None:
"""Write the message to the log file using the ``DEBUG`` level."""
write(msg, "DEBUG", html, attachment, launch_log)


def info(msg, html=False, also_console=False, attachment=None,
launch_log=False):
def info(msg: str, html: bool = False, also_console: bool = False, attachment: Optional[Dict[str, str]] = None,
launch_log: bool = False):
"""Write the message to the log file using the ``INFO`` level.
If ``also_console`` argument is set to ``True``, the message is written both to the log file and to the console.
Expand All @@ -89,17 +89,17 @@ def info(msg, html=False, also_console=False, attachment=None,
console(msg)


def warn(msg, html=False, attachment=None, launch_log=False):
def warn(msg: str, html: bool = False, attachment: Optional[Dict[str, str]] = None, launch_log: bool = False) -> None:
"""Write the message to the log file using the ``WARN`` level."""
write(msg, "WARN", html, attachment, launch_log)
write(msg, 'WARN', html, attachment, launch_log)


def error(msg, html=False, attachment=None, launch_log=False):
def error(msg: str, html: bool = False, attachment: Optional[Dict[str, str]] = None, launch_log: bool = False) -> None:
"""Write the message to the log file using the ``ERROR`` level."""
write(msg, "ERROR", html, attachment, launch_log)
write(msg, 'ERROR', html, attachment, launch_log)


def console(msg: str, newline: bool = True, stream: Literal['stdout', 'stderr'] = 'stdout'):
def console(msg: str, newline: bool = True, stream: str = 'stdout') -> None:
"""Write the message to the console.
If the ``newline`` argument is ``True``, a newline character is automatically added to the message.
Expand Down

0 comments on commit 79cd074

Please sign in to comment.