From f898302d97c10a139cb392d8c9ee2f085b5d0c64 Mon Sep 17 00:00:00 2001 From: Espy | Neko | 404 <34942042+neko404notfound@users.noreply.github.com> Date: Tue, 22 May 2018 22:16:03 +0100 Subject: [PATCH] Create loggable --- src/shared_libs/loggable | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/shared_libs/loggable diff --git a/src/shared_libs/loggable b/src/shared_libs/loggable new file mode 100644 index 0000000..10e9e59 --- /dev/null +++ b/src/shared_libs/loggable @@ -0,0 +1,21 @@ +#!/usr/bin/env python3.6 +# -*- coding: utf-8 -*- +""" +Neko404NotFound 2018, MIT + +A mixin class that injects a suitably named logger into class scope +at runtime. + +Chosen to make this a slotted class, which means (as far as I can remember) +that it is not suitable to be made into an abc.ABC class. Slots will +enable derived slotted classes to be a bit more efficient at runtime and +boast faster lookups. +""" +import logging + + +class Loggable: + __slots__ = ('logger',) + + def __init_subclass__(cls, **_): + cls.logger = logging.getLogger(cls.__qualname__)