Something went wrong. Try again.
A proof-of-concept proposal for turning standard Rubik's Cubes into smartcubes by embedding speakers into the cube's centercaps.
Something went wrong. Try again.
795 B · 30 lines
Python
at commit 59fa6d42
12345678910111213141516171819202122232425262728293031# This Source Code Form is subject to the terms of the Mozilla Public# License, v. 2.0. If a copy of the MPL was not distributed with this# file, You can obtain one at https://mozilla.org/MPL/2.0/.
class Logger: def __init__(self, file_name: str): self.file_name = f"./logs/{file_name}_log.txt" self.file = open(self.file_name, "a")
def __log(self, msg): print(msg) self.file.write(f"{msg}\n")
def info(self, msg): self.__log(f"[INFO] {msg}")
def warn(self, msg): self.__log(f"[WARN] {msg}")
def error(self, msg): self.__log(f"[ERROR] {msg}")
def debug(self, msg): self.__log(f"[DEBUG] {msg}")
def save_to_disk(self): self.file.flush()
def __del__(self): self.file.close()