Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
5474 Lượt xem

Hi,


I am working on setting up a development environment with Docker. When I use the print() method in a class method nothing gets actually printed anywhere (that I can find at least).


I've seen it work in videos on Youtube so I assume this si possible. Any clue how to make this work with a Docker setup?


Thanks!


Guillaume

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Try to use the logger.
import logging

_logger = logging.getLogger(__name__)

and then in your code you can use:
_logger.info(YOUR_STRING_OR_VARIABLE)

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Hi Marcelo,

Thanks a lot for your answer. This does work. I just thought it's a bit overkill to do a quick debugging.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 2 23
2386
0
thg 5 22
2209
1
thg 6 23
4570
1
thg 11 22
7255
1
thg 6 25
1601