|
1 | 1 | importcontextlib
|
2 | 2 | importimportlib
|
3 | 3 | importjson
|
| 4 | +importlogging |
4 | 5 | importos
|
5 | 6 | importre
|
6 | 7 | importsubprocess
|
@@ -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 | ifnotself.probackup_old_pathandold_binary:
|
77 |
| -print('PGPROBACKUPBIN_OLD is not set') |
| 78 | +logging.error('PGPROBACKUPBIN_OLD is not set') |
78 | 79 | exit(1)
|
79 | 80 |
|
80 | 81 | ifold_binary:
|
@@ -107,12 +108,11 @@ def run(self, command, gdb=False, old_binary=False, return_id=True, env=None,
|
107 | 108 | returnGDBobj(cmdline,self.test_class)
|
108 | 109 |
|
109 | 110 | try:
|
110 |
| -result=None |
111 | 111 | iftype(gdb)istupleandgdb[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 | ifoptionsisNone:
|
234 | 234 | options= []
|
235 | 235 | ifnotnodeandnotdata_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 | ifnotdatname:
|
@@ -502,7 +502,7 @@ def show(
|
502 | 502 | ifi=='':
|
503 | 503 | backup_record_split.remove(i)
|
504 | 504 | iflen(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 | defvalidate(
|
@@ -769,7 +769,7 @@ def load_backup_class(fs_type):
|
769 | 769 | iffs_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)
|
|