I'm working on my own version of the module logging, I'm almost finished with the base, but I get an error that I cant solve on my own.
I tried looking at others questions on so, but nothing helped me.
(Other questions I looked at: Question 1 - Question 2 - Docs)
The full error:
Traceback (most recent call last):
File ".\server.py", line 20, in <module>
debugger.status(True)
TypeError: status() missing 1 required positional argument: 'inp'
and my code:
class debugger():
def __init__(self, state=False):
self.state = state
def status(self, inp:bool):
if inp == True and self.state == False: print('Debugger activated')
elif inp == True and self.state == True: print('Debugger alredy started')
elif inp == False and self.state == True: print('Debugger stopped')
else: print('Debugger alredy stopped')
self.state = inp
def log(self, msg:str):
if self.state == True: print(f'[DEBUGGER]: {msg}')
else: pass
def __repr__(self):
if self.state == True: return 'Debugger status: Active'
else: return 'Debugger status: Disabled'
debugger.status(True)
debugger()
debugger.log('Test from debugger')
EDIT:
If i try to change the 3 lines at the bottom to:
debugger.status(debugger, True)
debugger()
debugger.log(debugger, 'Test from debugger')
I get:
Traceback (most recent call last):
File ".\server.py", line 22, in <module>
debugger.status(debugger, True)
File ".\server.py", line 8, in status
if inp == True and self.state == False: print('Debugger activated')
AttributeError: type object 'debugger' has no attribute 'state'