New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Substitution Strings #32
Comments
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:
My preference is for option 1 as it keeps things consistent with logger. If we keep option 1 need to determine name.
Though |
From @rimblas on June 16, 2014 14:20 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. 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. |
From @JuergenSchuster on June 17, 2014 6:46 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 :-) |
From @goodwish on December 31, 2014 2:34 When will 2.2.0 release? Thanks, |
From @goodwish on February 19, 2015 15:44 Howdy, When will we get this feature ? Is there an estimate ? Or, can I contribute on it? Thanks, |
Still up in the air about name for this. After reading http://en.wikipedia.org/wiki/Printf_format_string here are a list of names that I like
Names I no longer want to use:
Note the API call will look something like this: logger.log(logger.FN_NAME('My name is %s. My sal is %d', l_ename, l_sal)); |
I'm still "happy" with printf, still consistent with C, but if it's off the table, sprintf would be perfect. sprintf best reflects that you're applying values to a string. |
@rimblas Thanks for your feedback. Yes we could use
Regarding naming, if we run into future naming issues with |
printf is good. |
From @martindsouza on August 5, 2013 15:45
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.
Copied from original issue: tmuth#32
The text was updated successfully, but these errors were encountered: