readme.md hinzugefügt
parent
8a3f177ab3
commit
674e59fb5f
|
|
@ -0,0 +1,57 @@
|
|||
# Logger
|
||||
|
||||
### Sinn und Zweck
|
||||
|
||||
Logger wird zum loggen bei Scripten benutzt
|
||||
|
||||
### Wichtig!
|
||||
|
||||
### Stages
|
||||
**bestimmt welche Art der Information in die Logdatei aufgenommen wird**
|
||||
- ERROR
|
||||
- WARNING
|
||||
- INFO
|
||||
- DEBUG
|
||||
|
||||
### Times Logrotate
|
||||
**bestimmt wie oft eine Logdatei neu erzeugt wird**
|
||||
- ONE
|
||||
- HOURLY
|
||||
- DAILY
|
||||
- WEEKLY
|
||||
- MONTHLY
|
||||
|
||||
### Konstruktor
|
||||
|
||||
```python
|
||||
def __init__(self, path, file_name, sep=',', endl='\n', period=LogPeriod.ONE, level=LogLevel.INFO, out_time_f='%Y.%m.%d %H:%M:%S')
|
||||
```
|
||||
### Methoden
|
||||
```python
|
||||
def error(self, *args, **kwargs)
|
||||
```
|
||||
|
||||
```python
|
||||
def warning(self, *args, **kwargs)
|
||||
```
|
||||
|
||||
```python
|
||||
def info(self, *args, **kwargs)
|
||||
```
|
||||
|
||||
```python
|
||||
def debug(self, *args, **kwargs)
|
||||
```
|
||||
|
||||
### Codebeispiel
|
||||
```python
|
||||
if __name__ == '__main__':
|
||||
log = Logger('.', 'mylog.csv', level=LogLevel.DEBUG, period=LogPeriod.HOURLY)
|
||||
log.info('Hallo info')
|
||||
log.error('Hallo error')
|
||||
log.warning('Hallo warning')
|
||||
log.debug('Hallo debug')
|
||||
```
|
||||
|
||||
#### Quelle
|
||||
[inproduct-original](https://git.innproduct.de/alex/logger/src/branch/main/logger.py)
|
||||
Loading…
Reference in New Issue