|
1 | 1 | import contextlib |
2 | 2 | import importlib |
3 | 3 | import json |
| 4 | +import logging |
4 | 5 | import os |
5 | 6 | import re |
6 | 7 | import subprocess |
@@ -74,7 +75,7 @@ def run(self, command, gdb=False, old_binary=False, return_id=True, env=None, |
74 | 75 | command = [command[0], *self.backup_dir.pb_args, *command[1:]] |
75 | 76 |
|
76 | 77 | if not self.probackup_old_path and old_binary: |
77 | | - print('PGPROBACKUPBIN_OLD is not set') |
| 78 | + logging.error('PGPROBACKUPBIN_OLD is not set') |
78 | 79 | exit(1) |
79 | 80 |
|
80 | 81 | if old_binary: |
@@ -107,12 +108,11 @@ def run(self, command, gdb=False, old_binary=False, return_id=True, env=None, |
107 | 108 | return GDBobj(cmdline, self.test_class) |
108 | 109 |
|
109 | 110 | try: |
110 | | - result = None |
111 | 111 | if type(gdb) is tuple and gdb[0] == 'suspend': |
112 | 112 | # special test flow for manually debug probackup |
113 | 113 | gdb_port = gdb[1] |
114 | 114 | cmdline = ['gdbserver'] + ['localhost:' + str(gdb_port)] + cmdline |
115 | | - print("pg_probackup gdb suspended, waiting gdb connection on localhost:{0}".format(gdb_port)) |
| 115 | + logging.warning("pg_probackup gdb suspended, waiting gdb connection on localhost:{0}".format(gdb_port)) |
116 | 116 |
|
117 | 117 | start_time = time.time() |
118 | 118 | self.test_class.output = subprocess.check_output( |
@@ -233,7 +233,7 @@ def backup_node( |
233 | 233 | if options is None: |
234 | 234 | options = [] |
235 | 235 | if not node and not data_dir: |
236 | | - print('You must provide ether node or data_dir for backup') |
| 236 | + logging.error('You must provide ether node or data_dir for backup') |
237 | 237 | exit(1) |
238 | 238 |
|
239 | 239 | if not datname: |
@@ -502,7 +502,7 @@ def show( |
502 | 502 | if i == '': |
503 | 503 | backup_record_split.remove(i) |
504 | 504 | if len(header_split) != len(backup_record_split): |
505 | | - print(warning.format( |
| 505 | + logging.error(warning.format( |
506 | 506 | header=header, body=body, |
507 | 507 | header_split=header_split, |
508 | 508 | body_split=backup_record_split) |
@@ -581,7 +581,7 @@ def show_archive( |
581 | 581 | else: |
582 | 582 | show_splitted = self.run(cmd_list + options, old_binary=old_binary, |
583 | 583 | expect_error=expect_error).splitlines() |
584 | | - print(show_splitted) |
| 584 | + logging.error(show_splitted) |
585 | 585 | exit(1) |
586 | 586 |
|
587 | 587 | def validate( |
@@ -769,7 +769,7 @@ def load_backup_class(fs_type): |
769 | 769 | if fs_type: |
770 | 770 | implementation = fs_type |
771 | 771 |
|
772 | | - print("Using ", implementation) |
| 772 | + logging.info("Using ", implementation) |
773 | 773 | module_name, class_name = implementation.rsplit(sep='.', maxsplit=1) |
774 | 774 |
|
775 | 775 | module = importlib.import_module(module_name) |
|
0 commit comments