Coding Spirit

一位程序员,比较帅的那种

Log to local Python interpreter when test locally

1
2
3
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()
logger.info('some log)

But this will not log to Cloud Watch when test on the cloud.

Log to Cloud Watch

AWS Lambda Python runtime has pre-configured log handlers. To log to Cloud Watch:

1
2
3
logger = logging.getLogger()
logger.setLevel(logging.INFO)
logger.info('some log)

But this will not log to local Python interpreter when test locally.

Log to both Cloud Watch and local

1
2
3
4
5
6
# If there is no pre-configured log handler, we set basicConfig
if not logging.getLogger().hasHandlers():
logging.basicConfig(level=logging.INFO)

logger = logging.getLogger()
logger.setLevel(logging.INFO)

ERROR: Unable to connect to bitbake server, or start one (server startup failures would be in bitbake-cookerdaemon.log).

This issue might be encountered if bitbake server was unexpectedly closed. Bitbake will crate a lock file in build folder, if bitbake was shut down before remove this lock file, user can’t restart bitbake again. Solution is quite simple that just remove the lock file in the build folder:

1
rm bitbake.lock

gpio-keys is part of Linux input subsystem that can be used as key driver which can generate gpio interrupt. Comparing with user-implemented drivers base on GPIO subsystem, gpio-keys is much easier to use since it supports features like debounce/autorepeat by default.

Read more »

To add FFMPEG(libav) into CMake project, we can use pkgconfig:

1
2
3
4
5
6
7
8
9
10
11
12
13
find_package(PkgConfig REQUIRED)
pkg_check_modules(FFMPEG REQUIRED IMPORTED_TARGET
libavdevice
libavformat
libavcodec
libavutil
libavfilter
libswresample
libswscale
)

target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE PkgConfig::FFMPEG)
target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::FFMPEG)

Maybe not all libs are required by your project. Remove unnecessary libs if you want.

0%