Skip to content

Commit ca25669

Browse files
committed
Switch from print to using the logger.
Signed-off-by: Chris Lalancette <[email protected]>
1 parent 0fc7d54 commit ca25669

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

image_tools_py/cam2image_py.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def main(args=None):
122122
# parameter.
123123
custom_camera_qos_profile.history = args.history_policy
124124

125-
print("Publishing data on topic '%s'" % (args.topic))
125+
node.get_logger().info("Publishing data on topic '%s'" % (args.topic))
126126

127127
# Create the image publisher with our custom QoS profile.
128128
pub = node.create_publisher(
@@ -141,7 +141,7 @@ def flip_image_cb(msg):
141141

142142
output = 'on' if is_flipped else 'off'
143143

144-
print('Set flip mode to: ' + output)
144+
node.get_logger().info('Set flip mode to: ' + output)
145145

146146
custom_flip_qos_profile = qos_profile_sensor_data
147147
custom_flip_qos_profile.depth = 10
@@ -158,7 +158,7 @@ def flip_image_cb(msg):
158158
cam_cap.set(cv2.CAP_PROP_FRAME_WIDTH, args.width)
159159
cam_cap.set(cv2.CAP_PROP_FRAME_HEIGHT, args.height)
160160
if not cam_cap.isOpened():
161-
print('Could not open video stream')
161+
node.get_logger().fatal('Could not open video stream')
162162
sys.exit(1)
163163

164164
# Our main event loop will spin until the user presses CTRL-C to exit.
@@ -188,7 +188,7 @@ def flip_image_cb(msg):
188188
cv2.waitKey(1)
189189

190190
# Publish the image message and increment the frame_id.
191-
print('Publishing image #%d' % (frame_number))
191+
node.get_logger().info('Publishing image #%d' % (frame_number))
192192
pub.publish(msg)
193193
frame_number += 1
194194

image_tools_py/showimage_py.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def main(args=None):
9191
custom_qos_profile.history = args.history_policy
9292

9393
def image_cb(msg):
94-
print('Received image #' + msg.header.frame_id)
94+
node.get_logger().info('Received image #' + msg.header.frame_id)
9595

9696
if args.show_camera:
9797
dtype, n_channels = encoding2mat(msg.encoding)

0 commit comments

Comments
 (0)