FileLogger class

FileLogger class

Writes log messages to the file.

The FileLogger type exposes the following members:

Constructors

Constructor Description
init Initializes a logger that writes messages to a file.

Methods

Method Description
error Writes an error message to the console. Error log messages provide information about unrecoverable events in the application flow.
error_file
error_string
trace Writes a trace message to the log. Trace log messages provide generally useful information about application flow.
trace_file
trace_string
warning Writes a warning message to the console.
warning_file
warning_string

Example

from groupdocs.viewer import Viewer, ViewerSettings
from groupdocs.viewer.logging import FileLogger
from groupdocs.viewer.options import HtmlViewOptions

viewer_settings = ViewerSettings(logger=FileLogger("./log.txt"))
with Viewer("./sample.docx", settings=viewer_settings) as viewer:
    html_options = HtmlViewOptions.for_embedded_resources(
        "write_logs_to_file/page_{0}.html"
    )
    viewer.view(html_options)

See Also