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

N A asteriskteam at digium.com
Wed Aug 11 17:20:03 CDT 2021


Attention is currently required from: Joshua Colp, Kevin Harwell.
N A 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/360f4e5f_7408144e 
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);
             : 	}
> Since this is for logging custom levels via the dialplan I think you'd want to log the extension, pr […]
Hmm... personally, I was thinking to keep it more minimalist for the custom log, since I am already telling it what to log, and could add LOG(mylog,${CONTEXT},${EXTEN},${PRIORITY}) if I really wanted that. This isn't for Asterisk logging things, it's for the user logging things. My current custom logging solution, just using a subroutine and file, is relatively neat, with just logging the timestamp and the argument, so I wanted to make it as similar to that as possible, without adding noise to it.

My other thought is to make this an option, but that might be kind of messy. If this was an option in logger.conf, I suppose it wouldn't make sense to read that every time Log was called.

If you still think I should add the context,exten,priority, I'll go ahead and do it, my thinking is just that for a custom log it doesn't automatically belong there.



-- 
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: Joshua Colp <jcolp at sangoma.com>
Gerrit-Attention: Kevin Harwell <kharwell at digium.com>
Gerrit-Comment-Date: Wed, 11 Aug 2021 22:20:03 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
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/20210811/f0a23ec8/attachment.html>


More information about the asterisk-code-review mailing list