Add logging support for Repository class
This commit is contained in:
parent
c527367d76
commit
1ee3d10f3e
@ -3,7 +3,7 @@
|
|||||||
.. module:: rbackup.hierarchy.repository
|
.. module:: rbackup.hierarchy.repository
|
||||||
:synopsis: Class for structuring a backup repository.
|
:synopsis: Class for structuring a backup repository.
|
||||||
"""
|
"""
|
||||||
|
import logging
|
||||||
import os.path
|
import os.path
|
||||||
import datetime
|
import datetime
|
||||||
import glob
|
import glob
|
||||||
@ -12,6 +12,11 @@ from rbackup.hierarchy.hierarchy import Hierarchy
|
|||||||
from rbackup.hierarchy.snapshot import Snapshot
|
from rbackup.hierarchy.snapshot import Snapshot
|
||||||
|
|
||||||
|
|
||||||
|
# ========== Logging Setup ===========
|
||||||
|
syslog = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
# ========== Classes ==========
|
||||||
class Repository(Hierarchy):
|
class Repository(Hierarchy):
|
||||||
"""A class for interacting with a backup repository.
|
"""A class for interacting with a backup repository.
|
||||||
|
|
||||||
@ -134,11 +139,15 @@ class Repository(Hierarchy):
|
|||||||
|
|
||||||
:return: a new Snapshot object
|
:return: a new Snapshot object
|
||||||
"""
|
"""
|
||||||
|
syslog.debug("Creating snapshot")
|
||||||
path = os.path.join(self._snapshot_dir, f"snapshot-{name}")
|
path = os.path.join(self._snapshot_dir, f"snapshot-{name}")
|
||||||
|
|
||||||
self._curr_snapshot = Snapshot(path)
|
self._curr_snapshot = Snapshot(path)
|
||||||
self._snapshots.append(self._curr_snapshot)
|
self._snapshots.append(self._curr_snapshot)
|
||||||
|
|
||||||
|
syslog.debug("Snapshot created")
|
||||||
|
syslog.debug(f"Snapshot name: {self.curr_snapshot.name}")
|
||||||
|
|
||||||
def update_snapshots(self):
|
def update_snapshots(self):
|
||||||
"""Update the list of snapshots in this repository."""
|
"""Update the list of snapshots in this repository."""
|
||||||
self._snapshots = [
|
self._snapshots = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user