From c8b9518c119523999abf7c9aced53236e3229d77 Mon Sep 17 00:00:00 2001 From: Olli Graf Date: Sat, 29 Apr 2023 16:32:52 +0200 Subject: [PATCH] Logging Kapitel --- Readme.md | 5 +-- gpio/.gitignore | 2 ++ gpio/__pycache__/led.cpython-39.pyc | Bin 0 -> 806 bytes {teil14 => gpio}/led.py | 0 gpio/ledserver.log | 1 + gpio/ledserver.py | 32 ++++++++++++++++++ gpio/network/__init__.py | 3 ++ .../__pycache__/__init__.cpython-39.pyc | Bin 0 -> 183 bytes gpio/network/__pycache__/const.cpython-39.pyc | Bin 0 -> 262 bytes gpio/network/code.py | 10 ++++++ gpio/network/const.py | 19 +++++++++++ {logging => teil14}/conf.py | 0 {logging => teil14}/test.log | 0 {logging => teil14}/testlogging.py | 0 14 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 gpio/.gitignore create mode 100644 gpio/__pycache__/led.cpython-39.pyc rename {teil14 => gpio}/led.py (100%) create mode 100644 gpio/ledserver.log create mode 100755 gpio/ledserver.py create mode 100644 gpio/network/__init__.py create mode 100644 gpio/network/__pycache__/__init__.cpython-39.pyc create mode 100644 gpio/network/__pycache__/const.cpython-39.pyc create mode 100644 gpio/network/code.py create mode 100644 gpio/network/const.py rename {logging => teil14}/conf.py (100%) rename {logging => teil14}/test.log (100%) rename {logging => teil14}/testlogging.py (100%) diff --git a/Readme.md b/Readme.md index 5a254da..f8390cd 100644 --- a/Readme.md +++ b/Readme.md @@ -18,6 +18,7 @@ CC-BY-SA Olli Graf |11 | Datum und Zeit| |12 | Multithreading| |13 | Netzwerk| -|14 | GPIO| -|15 | Testing| +|14 | Logging| +|15 | GPIO| +|16 | Testing| diff --git a/gpio/.gitignore b/gpio/.gitignore new file mode 100644 index 0000000..c7fb3aa --- /dev/null +++ b/gpio/.gitignore @@ -0,0 +1,2 @@ +./__pycache__ +./network/__pycache__/* diff --git a/gpio/__pycache__/led.cpython-39.pyc b/gpio/__pycache__/led.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..41b6ef74915c2ac642b05d5f59c1224c816ec6a1 GIT binary patch literal 806 zcmYjO&2AGh5cXeoon#ZBs(>RL!=Wh>CxrMb(5@&+1Vs@R(rO!9?KZpK#p@MH1gG){ zJV1NomG*?hsjt9^@g^0q!DW<1}F<6f_WV10iO%AXXWKhD@(42hVp0{H zqb9Gfn9Gv*0~&O%peh;-aNR0XrHZRNV4k=;gnmDJGs7#|pyN*M9_;cafJGPBl5eP~ zir_Uo8qk{UPr`BS<&`ZeTl-No2}e=XRIssCzmVaO`}h9vG|$wqNQTA2p5}U9nQ~}V zl0JMiOqJXz7PVI@d-(d*ma9hq5HW6+GeQ-SAZH?=q=20|#5gtX6poimWee11S9Oto-p|;AHs<6#~HlXdY+Q(_4 z=V_i7cfl;T0T5=agE`?85chF_IW>J33?;HS(J=NKg1?_6JMK>!JvFmQrWzr}gHRIy zh%QX}Yix9)PfFo~k>yee`f~4`Xn|D~f{s5Pt-87{pyNzI5B@Awv95{@z3x9uBbq;f dhpJRPrEpc=1_*FK7-pnH1KOwD: MAIN: start diff --git a/gpio/ledserver.py b/gpio/ledserver.py new file mode 100755 index 0000000..a48064c --- /dev/null +++ b/gpio/ledserver.py @@ -0,0 +1,32 @@ +#! /usr/bin/python3 +from http.server import BaseHTTPRequestHandler,HTTPServer +import logging + +logging.basicConfig( format='%(asctime)-15s [%(levelname)s] %(funcName)s: %(message)s', filename='ledserver.log', level=logging.DEBUG) +class http_server: + def __init__(self): + def handler(*args): + myHandler(*args) + server = HTTPServer(('', 8080), handler) + +class myHandler(BaseHTTPRequestHandler): + def __init__(self,*args): + self.t1 = t1 + BaseHTTPRequestHandler.__init__(self, *args) + + def do_GET(self): + logging.debug('GET: empfangen') + self.send_response(200) + self.send_header('Content-type','text/html') + self.end_headers() + self.wfile.write(self.t1.show()) #Doesnt work + return + +class main: + def __init__(self): + + self.server = http_server() + +if __name__ == '__main__': + logging.debug('MAIN: start') + main() diff --git a/gpio/network/__init__.py b/gpio/network/__init__.py new file mode 100644 index 0000000..55552da --- /dev/null +++ b/gpio/network/__init__.py @@ -0,0 +1,3 @@ +from .const import __ADDRESSLOCAL__ +#from .const import __ADDRESSREMOTE__ + diff --git a/gpio/network/__pycache__/__init__.cpython-39.pyc b/gpio/network/__pycache__/__init__.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..66f1280e8c2e35bc43f228e216351d8ae34fc2d5 GIT binary patch literal 183 zcmYe~<>g`kf(_c9DZW7ZF^Gc(44TX@8G*u@ zjJE{h;~iaGf?R`xef*sred6Q&G?}7Ulk@Y6ONu~7tYj!+22x<+m!5t`er~FML8g8| zWl2VUUUq3wv3^NvW{#nWeqL%xd45s0etdjpUS>&ryk0@&Ee@O9{FKt1R6CGmpMjVG E01AXEJpcdz literal 0 HcmV?d00001 diff --git a/gpio/network/__pycache__/const.cpython-39.pyc b/gpio/network/__pycache__/const.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0e3b26c0b5084458536323ba9dac3b825bc53d52 GIT binary patch literal 262 zcmYe~<>g`kf|=T$DV>ZA439w^WWWOCH~?|68jwg~NMX!jh+;@#iegMW$??KCCR{`$##paI6pZ%wIqroK0d%dC?r1q7H@iL zNk)EgNm6BAVs7d!ZYUSTiQKA0{7gPex%*!q