File tree Expand file tree Collapse file tree 3 files changed +33
-51
lines changed
Expand file tree Collapse file tree 3 files changed +33
-51
lines changed Original file line number Diff line number Diff line change @@ -7,21 +7,21 @@ add_executable(log-simple simple.c)
77target_link_libraries (log -simple bfdev)
88add_test (log -simple log -simple)
99
10- add_executable (log -date date .c)
11- target_link_libraries (log -date bfdev)
12- add_test (log -date log -date )
10+ add_executable (log -modules modules .c)
11+ target_link_libraries (log -modules bfdev)
12+ add_test (log -modules log -modules )
1313
1414if (${CMAKE_PROJECT_NAME} STREQUAL "bfdev" )
1515 install (FILES
1616 simple.c
17- date .c
17+ modules .c
1818 DESTINATION
1919 ${CMAKE_INSTALL_DOCDIR} /examples/log
2020 )
2121
2222 install (TARGETS
2323 log -simple
24- log -date
24+ log -modules
2525 DESTINATION
2626 ${CMAKE_INSTALL_DOCDIR} /bin
2727 )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ /* SPDX-License-Identifier: GPL-2.0-or-later */
2+ /*
3+ * Copyright(c) 2023 Zhenlin Wang <sanpeqf@gmail.com>
4+ */
5+
6+ #define MODULE_NAME "log-modules"
7+ #define bfdev_log_fmt (fmt ) MODULE_NAME ": " fmt
8+
9+ #include <bfdev/log.h>
10+ #include <bfdev/modules/log.h>
11+ #include <unistd.h>
12+
13+ int
14+ main (int argc , const char * argv [])
15+ {
16+ unsigned int count ;
17+
18+ bfdev_log_localtime_enable (& bfdev_log_default );
19+ bfdev_log_hostname_enable (& bfdev_log_default );
20+ bfdev_log_pid_enable (& bfdev_log_default );
21+
22+ for (count = 0 ; count < 3 ; ++ count ) {
23+ bfdev_log_info ("Hello World!\n" );
24+ sleep (1 );
25+ }
26+
27+ return 0 ;
28+ }
You can’t perform that action at this time.
0 commit comments