[Asterisk-code-review] logger: Add custom logging capabilities (asterisk[master])

Kevin Harwell asteriskteam at digium.com
Fri Aug 13 10:35:19 CDT 2021


Attention is currently required from: N A, Joshua Colp.
Kevin Harwell has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/16222 )

Change subject: logger: Add custom logging capabilities
......................................................................


Patch Set 6:

(1 comment)

File apps/app_verbose.c:

https://gerrit.asterisk.org/c/asterisk/+/16222/comment/9b2898e8_b0705cd2 
PS6, Line 139: 	} else {
             : 		int level = ast_logger_dynamic_level(args.level);
             : 		if (level > -1) {
             : 			ast_log_dynamic_level(level, "%s\n", args.msg);
             : 		} else {
             : 			ast_log(LOG_ERROR, "Unknown log level: '%s'\n", args.level);
             : 		}
             : 	}
             : 
             : 	if (lnum > -1) {
             : 		snprintf(context, sizeof(context), "@ %s", ast_channel_context(chan));
             : 		snprintf(extension, sizeof(extension), "Ext. %s", ast_channel_exten(chan));
             : 
             : 		ast_log(lnum, extension, ast_channel_priority(chan), context, "%s\n", args.msg);
             : 	}
> It makes sense why you'd want it the way you have it for some use cases. […]
I looked at the log formatters. It seems the [default] formatter does not output line number and function name. Or in this case that'd be the priority and context. So I think you'd be mostly there logging custom levels in the same way as the current code does.

If someone wanted those values output (priority and context) too then they could specify the [plain] formatter in the logger.conf file.

A note though. For some reason the [default] formatter _does_ output the line number/priority and function name/context similar to [plain] when logging to the console. Not sure if that's a bug, but I'd be hesitant to change it.



-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/16222
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: If082703cf81a436ae5a565c75225fa8c0554b702
Gerrit-Change-Number: 16222
Gerrit-PatchSet: 6
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Attention: N A <mail at interlinked.x10host.com>
Gerrit-Attention: Joshua Colp <jcolp at sangoma.com>
Gerrit-Comment-Date: Fri, 13 Aug 2021 15:35:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: N A <mail at interlinked.x10host.com>
Comment-In-Reply-To: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210813/ea70d519/attachment.html>


More information about the asterisk-code-review mailing list