import logging

root_logger = logging.getLogger()

fmt = "%(asctime)s %(levelname)-8.8s [%(name)s:%(lineno)s] %(message)s"
formatter = logging.Formatter(fmt)

sh = logging.StreamHandler()
sh.setFormatter(formatter)
sh.setLevel(logging.INFO)

fh = logging.FileHandler("fancymath.log")
fh.setFormatter(formatter)
fh.setLevel(logging.NOTSET)

root_logger.addHandler(sh)
root_logger.addHandler(fh)

root_logger.setLevel(logging.NOTSET)

logger = logging.getLogger(__name__)

logger.info("Welcome to FancyMath, a silly library for demonstrations.")

from fancymath.vector import Vector

v1 = Vector(1,2,3)
v2 = Vector(2,3,4)

v3 = v1.dot(v2)

logger.info(f"{v1=}")
logger.info(f"{v2=}")
logger.info(f"{v3=}")

try:
    v4 = v2.dot([1,2,3])
except ValueError as err:
    logger.exception(err)
