Lu-Yi-Hsun / iqoptionapi

IQ Option API
372 stars 289 forks source link

How do I disable the logging message #80

Closed hesller closed 5 years ago

hesller commented 5 years ago

I dont want the program to send messages to the console all the time How do I disable these loggings

I0326 09:38:09.514876 5596 client.py:42] {"name":"timeSync","msg":1553603888316} I0326 09:38:10.533296 5596 client.py:42] {"name":"timeSync","msg":1553603889328} I0326 09:38:11.545392 5596 client.py:42] {"name":"timeSync","msg":1553603890340} I0326 09:38:12.555047 5596 client.py:42] {"name":"timeSync","msg":1553603891352} I0326 09:38:13.565037 5596 client.py:42] {"name":"timeSync","msg":1553603892363} I0326 09:38:14.575298 5596 client.py:42] {"name":"timeSync","msg":1553603893376} I0326 09:38:15.585309 5596 client.py:42] {"name":"timeSync","msg":1553603894388} I0326 09:38:16.605177 5596 client.py:42] {"name":"timeSync","msg":1553603895400} I0326 09:38:16.606171 5596 client.py:42] {"name":"heartbeat","msg":1553603895400}

JafferWilson commented 5 years ago

Please put your code here. What you have tried so we can understand the issue.

hesller commented 5 years ago

@JafferWilson I am using the very same example given in the docs for realtime data, but I would like to display only the logs related to the candles.

====== The code ============== from iqoptionapi.stable_api import IQ_Option import logging import time

logging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(message)s')

print("login...") I_want_money=IQ_Option("email","password") goal="EURUSD" size="all"#size=[1,5,10,15,30,60,120,300,600,900,1800,3600,7200,14400,28800,43200,86400,604800,2592000,"all"] maxdict=10 print("start stream...") I_want_money.start_candles_stream(goal,size,maxdict)

DO something

print("Do something...") time.sleep(10)

print("print candles") cc=I_want_money.get_realtime_candles(goal,size) for k in cc: print(goal,"size",k,cc[k]) print("stop candle") I_want_money.stop_candles_stream(goal,size)

===== my console keeps displaying ======== I0326 09:38:09.514876 5596 client.py:42] {"name":"timeSync","msg":1553603888316} I0326 09:38:10.533296 5596 client.py:42] {"name":"timeSync","msg":1553603889328} I0326 09:38:11.545392 5596 client.py:42] {"name":"timeSync","msg":1553603890340} I0326 09:38:12.555047 5596 client.py:42] {"name":"timeSync","msg":1553603891352} I0326 09:38:13.565037 5596 client.py:42] {"name":"timeSync","msg":1553603892363} I0326 09:38:14.575298 5596 client.py:42] {"name":"timeSync","msg":1553603893376} I0326 09:38:15.585309 5596 client.py:42] {"name":"timeSync","msg":1553603894388} I0326 09:38:16.605177 5596 client.py:42] {"name":"timeSync","msg":1553603895400} I0326 09:38:16.606171 5596 client.py:42] {"name":"heartbeat","msg":1553603895400} . ... and so on

hesller commented 5 years ago

I solved it by applying logging.disable(level=logging.CRITICAL)

JafferWilson commented 5 years ago

Great .. then please close this thread.