TeeJee.Logging

1. Overview

The TeeJee.Logging module provides application logging subsystem for BastionGuard Backup. It controls console and file logging, timestamps, colors, debug output, warnings, errors, and the shared session log stream.

The implementation is written in Vala and uses GLib/GIO together with the application utility namespaces required by the file.


2. Dependencies and Integration

The module imports:

  • TeeJee.Misc

Key runtime integrations include:

  • GIO/GLib streams – filesystem and process I/O

3. Declared Types

3.1 TeeJee.Logging

namespace TeeJee.Logging

This namespace groups stateless utility functions and shared constants.


4. State, Properties, Constants, and Signals

Public and protected state

  • public DataOutputStream dos_log – Session log output stream.
  • public string err_log – Runtime state used by the module.
  • public bool LOG_ENABLE – Global switch controlling whether logging is emitted.
  • public bool LOG_TIMESTAMP – Controls timestamp prefixes.
  • public bool LOG_COLORS – Controls ANSI terminal colors.
  • public bool LOG_DEBUG – Enables debug messages.
  • public bool LOG_COMMANDS – Enables command logging.

5. Public API and Operational Methods

5.1 log_msg()

public void log_msg (string message, bool highlight = false)

Formats and emits diagnostic information for msg.

  • Catches runtime errors locally and reports them through the logging layer or return value.

5.2 log_error()

public void log_error (string message, bool highlight = false, bool is_warning = false)

Formats and emits diagnostic information for error.

  • Catches runtime errors locally and reports them through the logging layer or return value.

5.3 log_debug()

public void log_debug (string message)

Formats and emits diagnostic information for debug.

  • Catches runtime errors locally and reports them through the logging layer or return value.

5.4 log_to_file()

public void log_to_file (string message, bool highlight = false)

Formats and emits diagnostic information for to file.

  • Catches runtime errors locally and reports them through the logging layer or return value.

6. Operational Flow

  1. Expose the module data or constant text to the caller.

7. Error Handling and Diagnostics

  • GLib and filesystem exceptions are caught locally in the operations that can fail.
  • The TeeJee logging layer records errors, debug state, generated commands, and operational messages.

8. Runtime and Security Considerations

  • Error handling: callers should inspect nullable returns and Boolean status values because utility methods generally log failures instead of throwing them further.

9. Licensing

The source is distributed under the GNU General Public License version 2 or any later version.

The source header identifies:

Copyright 2012-2018 Tony George <teejeetech@gmail.com>