Closed martindsouza closed 9 years ago
This is still very much up for debate as to how to implement this. Several options:
Decision: Built a wrapper to support option 2. This just takes in a set of strings for the substitution strings.
Example:
declare
l_ename varchar2(255) := 'bob';
l_sal number := 3;
l_scope logger_logs.scope%type := 'test';
begin
logger.log(logger.get_fmt_msg('My name is %s. My sal is %d. Unreferenced: %s', l_ename, l_sal), l_scope);
end;
/
My name is bob. My sal is 3. Unreferenced:
Still need to decide how to implement this:
logger.printf(p_msg, p_s01, p_s02..., p_scope, p_level)
logger.log_printf(p_msg, p_scope, p_s01 ...)
My preference is for option 1 as it keeps things consistent with logger. If we keep option 1 need to determine name.
Though printf
is more standard, it is not a true "print" procedure as it's not printing, rather returning a value.
I like the printf idea and sys.utl_lms with a wrapper sounds like the perfect way to go. My suggestion, add "f" or "printf" as a function that log can use. logger.log(logger.f(p_msg, p_arg1, p_arg2...), p_scope);
Alternatively, there would be value to a "logf" that merges log and printf into one call. In this case I would just have scope as the first parameter and forgo the others and follow with msg and args. Perhaps even skip the scope and set it manually in a separate call as you had mentioned. That seems like a useful approach too.
I'm not a 100% sure if I understood Jorge's approach, but if it is working the way I think it is, I like the idea, and the printf :-)
When will 2.2.0 release?
Thanks, Charlie 木匠 | DBA
Howdy,
When will we get this feature ? Is there an estimate ?
Or, can I contribute on it?
Thanks, Charlie 木匠 | Database Architect Developer
This issue was moved to OraOpenSource/Logger#32
Thanks to John Scott for this idea.
Would like the ability to support substitution strings. For example: "Updated %num_rows% in table out of %total_rows%".
John and I discussed possible implementation options. For now here's what is purposed:
Ex:
Alternatively, instead of p_do_substitutions we can us p_param_type with 'DEFAULT'/'PARAMS' and 'SUBSTITUTION' (or something like that). We can create global constants to manage. This may be the better option.