16
16
* RFC 854 - https://tools.ietf.org/html/rfc854
17
17
*/
18
18
19
- #define SYS_LOG_LEVEL CONFIG_SYS_LOG_TELNET_CONSOLE_LEVEL
20
- #define SYS_LOG_DOMAIN "net/telnet"
21
- #include <logging/sys_log.h>
19
+ #define LOG_LEVEL CONFIG_TELNET_CONSOLE_LOG_LEVEL
20
+ #define LOG_DOMAIN net_telnet
21
+ #include <logging/log.h>
22
+ LOG_MODULE_REGISTER (LOG_DOMAIN );
22
23
23
24
#include <zephyr.h>
24
25
#include <init.h>
@@ -226,7 +227,7 @@ static void telnet_sent_cb(struct net_context *client,
226
227
{
227
228
if (status ) {
228
229
telnet_end_client_connection ();
229
- SYS_LOG_ERR ("Could not sent last packet" );
230
+ LOG_ERR ("Could not sent last packet" );
230
231
}
231
232
}
232
233
@@ -313,7 +314,7 @@ static inline void telnet_reply_command(void)
313
314
telnet_reply_do_command ();
314
315
break ;
315
316
default :
316
- SYS_LOG_DBG ("Operation %u not handled" ,
317
+ LOG_DBG ("Operation %u not handled" ,
317
318
telnet_cmd .op );
318
319
break ;
319
320
}
@@ -340,7 +341,7 @@ static inline bool telnet_handle_command(struct net_pkt *pkt)
340
341
#ifdef CONFIG_TELNET_CONSOLE_SUPPORT_COMMAND
341
342
cmd = (struct telnet_simple_command * )l_start ;
342
343
343
- SYS_LOG_DBG ("Got a command %u/%u/%u" , cmd -> iac , cmd -> op , cmd -> opt );
344
+ LOG_DBG ("Got a command %u/%u/%u" , cmd -> iac , cmd -> op , cmd -> opt );
344
345
345
346
if (!k_sem_take (& cmd_lock , K_NO_WAIT )) {
346
347
telnet_command_cpy (& telnet_cmd , cmd );
@@ -401,7 +402,7 @@ static void telnet_recv(struct net_context *client,
401
402
if (!pkt || status ) {
402
403
telnet_end_client_connection ();
403
404
404
- SYS_LOG_DBG ("Telnet client dropped (AF_INET%s) status %d" ,
405
+ LOG_DBG ("Telnet client dropped (AF_INET%s) status %d" ,
405
406
net_context_get_family (client ) == AF_INET ?
406
407
"" : "6" , status );
407
408
return ;
@@ -433,17 +434,17 @@ static void telnet_accept(struct net_context *client,
433
434
void * user_data )
434
435
{
435
436
if (error ) {
436
- SYS_LOG_ERR ("Error %d" , error );
437
+ LOG_ERR ("Error %d" , error );
437
438
goto error ;
438
439
}
439
440
440
441
if (client_cnx ) {
441
- SYS_LOG_WRN ("A telnet client is already in." );
442
+ LOG_WRN ("A telnet client is already in." );
442
443
goto error ;
443
444
}
444
445
445
446
if (net_context_recv (client , telnet_recv , 0 , NULL )) {
446
- SYS_LOG_ERR ("Unable to setup reception (family %u)" ,
447
+ LOG_ERR ("Unable to setup reception (family %u)" ,
447
448
net_context_get_family (client ));
448
449
goto error ;
449
450
}
@@ -452,7 +453,7 @@ static void telnet_accept(struct net_context *client,
452
453
goto error ;
453
454
}
454
455
455
- SYS_LOG_DBG ("Telnet client connected (family AF_INET%s)" ,
456
+ LOG_DBG ("Telnet client connected (family AF_INET%s)" ,
456
457
net_context_get_family (client ) == AF_INET ? "" : "6" );
457
458
458
459
orig_printk_hook = __printk_get_hook ();
@@ -470,32 +471,32 @@ static void telnet_setup_server(struct net_context **ctx, sa_family_t family,
470
471
struct sockaddr * addr , socklen_t addrlen )
471
472
{
472
473
if (net_context_get (family , SOCK_STREAM , IPPROTO_TCP , ctx )) {
473
- SYS_LOG_ERR ("No context available" );
474
+ LOG_ERR ("No context available" );
474
475
goto error ;
475
476
}
476
477
477
478
if (net_context_bind (* ctx , addr , addrlen )) {
478
- SYS_LOG_ERR ("Cannot bind on family AF_INET%s" ,
479
+ LOG_ERR ("Cannot bind on family AF_INET%s" ,
479
480
family == AF_INET ? "" : "6" );
480
481
goto error ;
481
482
}
482
483
483
484
if (net_context_listen (* ctx , 0 )) {
484
- SYS_LOG_ERR ("Cannot listen on" );
485
+ LOG_ERR ("Cannot listen on" );
485
486
goto error ;
486
487
}
487
488
488
489
if (net_context_accept (* ctx , telnet_accept , K_NO_WAIT , NULL )) {
489
- SYS_LOG_ERR ("Cannot accept" );
490
+ LOG_ERR ("Cannot accept" );
490
491
goto error ;
491
492
}
492
493
493
- SYS_LOG_DBG ("Telnet console enabled on AF_INET%s" ,
494
+ LOG_DBG ("Telnet console enabled on AF_INET%s" ,
494
495
family == AF_INET ? "" : "6" );
495
496
496
497
return ;
497
498
error :
498
- SYS_LOG_ERR ("Unable to start telnet on AF_INET%s" ,
499
+ LOG_ERR ("Unable to start telnet on AF_INET%s" ,
499
500
family == AF_INET ? "" : "6" );
500
501
501
502
if (* ctx ) {
@@ -549,7 +550,7 @@ static int telnet_console_init(struct device *arg)
549
550
NULL , NULL , NULL ,
550
551
K_PRIO_COOP (TELNET_PRIORITY ), 0 , K_MSEC (10 ));
551
552
552
- SYS_LOG_INF ("Telnet console initialized" );
553
+ LOG_INF ("Telnet console initialized" );
553
554
554
555
return 0 ;
555
556
}
0 commit comments