-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
Trying to use adafruit_logging to write logs to an SD card on an AdaLogger mounted to a RP Pico W. Writing to SD card works (using csvwriter or simply using file.write), but adafruit_logging does not. Tried the following simple test:
# Debug CP logging 2023/10/07
import board
import sdcardio
import busio
import digitalio
import storage
import adafruit_logging as logging
#
# SPI SD_CS pin
SD_CS = board.GP17
# SPI setup for SD card
spi = busio.SPI(board.GP18, board.GP19, board.GP16)
sdcard = sdcardio.SDCard(spi, SD_CS)
vfs = storage.VfsFat(sdcard)
try:
storage.mount(vfs, "/sd")
print("\nSD card mounted")
#l.info('\nSD card mounted')
except ValueError:
print("No SD card")
#l.error('No SD card')
# Setup log handler
l = logging.getLogger('sdfile')
l.addHandler(logging.FileHandler('/sd/log.txt'))
l.setLevel(logging.DEBUG)
l.debug('debug')
with open("/sd/log.txt", "a") as f:
f.write("Hello world!\r\n")
I believe that this should have resulted in a Hello world! message then a debug message being written to the log.txt file. The only message written to the log.txt file was the Hello world! message.
Board has Circuit Python 8.2.4 installed.
Metadata
Metadata
Assignees
Labels
No labels