Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
Apache/2.4.52 (Ubuntu)
Server IP : 192.168.1.1 & Your IP : 18.222.147.70
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
lib /
python3 /
dist-packages /
twisted /
logger /
Delete
Unzip
Name
Size
Permission
Date
Action
__pycache__
[ DIR ]
drwxr-xr-x
2024-11-28 06:59
test
[ DIR ]
drwxr-xr-x
2024-11-28 06:59
__init__.py
3.29
KB
-rw-r--r--
2022-02-07 13:12
_buffer.py
1.49
KB
-rw-r--r--
2022-02-07 13:12
_capture.py
624
B
-rw-r--r--
2022-02-07 13:12
_file.py
2.28
KB
-rw-r--r--
2022-02-07 13:12
_filter.py
6.73
KB
-rw-r--r--
2022-02-07 13:12
_flatten.py
4.88
KB
-rw-r--r--
2022-02-07 13:12
_format.py
11.6
KB
-rw-r--r--
2022-02-07 13:12
_global.py
8.44
KB
-rw-r--r--
2022-02-07 13:12
_interfaces.py
2.29
KB
-rw-r--r--
2022-02-07 13:12
_io.py
4.46
KB
-rw-r--r--
2022-02-07 13:12
_json.py
8.24
KB
-rw-r--r--
2022-02-07 13:12
_legacy.py
5.12
KB
-rw-r--r--
2022-02-07 13:12
_levels.py
2.92
KB
-rw-r--r--
2022-02-07 13:12
_logger.py
9.75
KB
-rw-r--r--
2022-02-07 13:12
_observer.py
3.17
KB
-rw-r--r--
2022-02-07 13:12
_stdlib.py
4.44
KB
-rw-r--r--
2022-02-07 13:12
_util.py
1.37
KB
-rw-r--r--
2022-02-07 13:12
Save
Rename
# -*- test-case-name: twisted.logger.test.test_file -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ File log observer. """ from typing import IO, Any, Callable, Optional from zope.interface import implementer from twisted.python.compat import ioType from ._format import formatEventAsClassicLogText, formatTime, timeFormatRFC3339 from ._interfaces import ILogObserver, LogEvent @implementer(ILogObserver) class FileLogObserver: """ Log observer that writes to a file-like object. """ def __init__( self, outFile: IO[Any], formatEvent: Callable[[LogEvent], Optional[str]] ) -> None: """ @param outFile: A file-like object. Ideally one should be passed which accepts text data. Otherwise, UTF-8 L{bytes} will be used. @param formatEvent: A callable that formats an event. """ if ioType(outFile) is not str: self._encoding: Optional[str] = "utf-8" else: self._encoding = None self._outFile = outFile self.formatEvent = formatEvent def __call__(self, event: LogEvent) -> None: """ Write event to file. @param event: An event. """ text = self.formatEvent(event) if text: if self._encoding is None: self._outFile.write(text) else: self._outFile.write(text.encode(self._encoding)) self._outFile.flush() def textFileLogObserver( outFile: IO[Any], timeFormat: Optional[str] = timeFormatRFC3339 ) -> FileLogObserver: """ Create a L{FileLogObserver} that emits text to a specified (writable) file-like object. @param outFile: A file-like object. Ideally one should be passed which accepts text data. Otherwise, UTF-8 L{bytes} will be used. @param timeFormat: The format to use when adding timestamp prefixes to logged events. If L{None}, or for events with no C{"log_timestamp"} key, the default timestamp prefix of C{"-"} is used. @return: A file log observer. """ def formatEvent(event: LogEvent) -> Optional[str]: return formatEventAsClassicLogText( event, formatTime=lambda e: formatTime(e, timeFormat) ) return FileLogObserver(outFile, formatEvent)