Skip to content

Commit 2ee0681

Browse files
committed
Logging order fixed
1 parent 32a479b commit 2ee0681

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Adafruit_TSL2561/Adafruit_TSL2561.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@
3030
Added hack so that with autogain every sample goes from 1x to 16x as going from 16x to 1x does not work
3131
"""
3232

33+
import logging
34+
# Logging needs to be set before any other library is imported
35+
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
36+
3337
import sys
3438
import time
35-
import logging
3639
from Adafruit_I2C import Adafruit_I2C
3740

3841

@@ -548,8 +551,6 @@ def calculate_avg_lux(self, testavg=TSL2561_NO_OF_AVG_SAMPLES):
548551
LightSensor = AdafruitTSL2561()
549552
LightSensor.enable_auto_gain(True)
550553

551-
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
552-
553554
# See if "loop" has been passed as an arg.
554555
try:
555556
arg = sys.argv[1]

0 commit comments

Comments
 (0)