direct.directnotify.RotatingLog

from direct.directnotify.RotatingLog import RotatingLog

Inheritance diagram

Inheritance diagram of direct.directnotify.RotatingLog

class RotatingLog(path: str = './log_file', hourInterval: int | None = 24, megabyteLimit: int | None = 1024)[source]

Bases: object

An open() replacement that will automatically open and write to a new file if the prior file is too large or after a time interval.

__init__(self, path: str = './log_file', hourInterval: int | None = 24, megabyteLimit: int | None = 1024) None[source]
Parameters
  • path – a full or partial path with file name.

  • hourInterval – the number of hours at which to rotate the file.

  • megabyteLimit – the number of megabytes of file size the log may grow to, after which the log is rotated. Note: The log file may get a bit larger than limit do to writing out whole lines (last line may exceed megabyteLimit or “megabyteGuidline”).

close(self) None[source]
filePath(self) str[source]
fileno(self) int[source]
flush(self) None[source]
isatty(self) bool[source]
read(self, size)[source]
readline(self, size)[source]
readlines(self, sizehint)[source]
rotate(self) None[source]

Rotate the log now. You normally shouldn’t need to call this. See write().

seek(self, offset: int, whence: int = 0) int[source]
shouldRotate(self) bool[source]

Returns a bool about whether a new log file should be created and written to (while at the same time stopping output to the old log file and closing it).

tell(self) int[source]
truncate(self, size: int | None) int[source]
write(self, data: str) int | None[source]

Write the data to either the current log or a new one, depending on the return of shouldRotate() and whether the new file can be opened.

writelines(self, sequence: Iterable[str]) None[source]
xreadlines(self)[source]