--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To post to this group, send email to php...@googlegroups.com.
To unsubscribe from this group, send email to php-fig+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
On 09.12.2012 20:45, guilher...@gmail.com wrote:I don't know what others think about this, but ICU's API is overly
> Regarding the variable replacement, I'm pro using ICU's MessageFormatter. =)
>
> http://docs.php.net/messageformatter
> http://userguide.icu-project.org/formatparse/messages
complex for the logging use case IMO. We really don't need all the
flexibility, and for the simple case it seems quite painful to use. And
then there's the fact that intl isn't present on many installs which is
another pain.
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To post to this group, send email to php...@googlegroups.com.
To unsubscribe from this group, send email to php-fig+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
2012/12/9 Jordi Boggiano <j.bog...@seld.be>On 09.12.2012 20:45, guilher...@gmail.com wrote:I don't know what others think about this, but ICU's API is overly
> Regarding the variable replacement, I'm pro using ICU's MessageFormatter. =)
>
> http://docs.php.net/messageformatter
> http://userguide.icu-project.org/formatparse/messages
complex for the logging use case IMO. We really don't need all the
flexibility, and for the simple case it seems quite painful to use. And
then there's the fact that intl isn't present on many installs which is
another pain.Yes, It's a separate package on Ubuntu Debian and one cannot assume, that it is available.
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To post to this group, send email to php...@googlegroups.com.
To unsubscribe from this group, send email to php-fig+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To post to this group, send email to php...@googlegroups.com.
To unsubscribe from this group, send email to php-fig+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
To be clear, I am *not* suggesting that we add a new interface to the proposal. I think the "writer" part of it is up to implementors. My only objection, such as it is, is to the specifying of particular delimiters within messages at the LoggerInterface level.
Using %class% as key for consistency is one thing, but I am not sure
what you suggest is a good idea, because that would mean the
implementation would just replace all keys in the context, which could
easily lead to conflicts with the message if you are not careful or use
user input and such as context data.
-- pmj
As the purpose of PSRs (including this one) is ostensibly to promote interoperability, I have to agree that defining placeholder delimiters should be considered beyond the scope of this document. In my opinion, doing does does not simply fail to promote interoperability, it actively inhibits it.
On Dec 10, 2012, at 7:38 PM, Matthew Lanigan wrote:As the purpose of PSRs (including this one) is ostensibly to promote interoperability, I have to agree that defining placeholder delimiters should be considered beyond the scope of this document. In my opinion, doing does does not simply fail to promote interoperability, it actively inhibits it.Excuse me for being a dunderhead, but is that a typo or are we on different planets? Is that saying:(a) The specification of placeholder-handling MUST be within scope to promote functional interoperability. OMITTING placeholders from the specification will actively inhibit functional interoperability.(b) The specification of placeholder-handling MUST NOT be within scope to promote functional interoperability. INCLUDING placeholders in the specification will actively inhibit functional interoperability.I agree with "a" and disagree with "b" for the reasons that have been previously discussed on this list.
I will add a huge portion of critic. But this is PSR. It should be close to perfect for users and vendors.
1. I still can't understand what is the difference between
$logger->debug('Some info with %parameter%', ['%parameter%' => $parameter]);
and
$logger->debug(sprintf('Some info with %s', $parameter), ['parameter' => $parameter]);
This feature adds really small advantage, but will require an implementation in ALL libraries with the same simple code.
2. We have methods like error, warn, etc in the interface, so ALL libraries will have to implement this methods, but this methods will have the same code in 99.9% of situations
public function error($message, array $context = [])
{
$this->log(LogLevel::ERROR, $message, $context);
}
More over a client code will expect such logic.
So It's better to have an interface with 1 log($level, $message, array $context = array()) method and have a wrapper with placeholders, level shortcut methods etc. Than each library will implement only 1 main method.
3. Log levels do not have any order. It's better to use default int values instead of strings from linked rfc
0 Emergency: system is unusable
1 Alert: action must be taken immediately
2 Critical: critical conditions
3 Error: error conditions
4 Warning: warning conditions
5 Notice: normal but significant condition
6 Informational: informational messages
7 Debug: debug-level messages
4. Log level class can have default Enum methods to get all values, or get value from name, etc.
-- Ivan Enderlin Developer of Hoa http://hoa.42/ or http://hoa-project.net/ PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis) http://disc.univ-fcomte.fr/ and http://www.inria.fr/ Member of HTML and WebApps Working Group of W3C http://w3.org/
I don't mean to be the party pooper here, but I'm really not a fan of the %delimiters%. Is there any way at all we can add a setDelimiters($left, $right) method to the interface? Not a deal breaker if not, but *man* it would be nice to let projects use their own delmiters. Lithium and others have {foo}, Aura has {:foo}, Drupal has %foo%, I'm sure someone out there has {{foo}}. It's the kind of thing that can be set once before the Logger implementation is injected into whatever needs it.
And instead logging to a random level you could also quickly write:
$logger->debug('Foobar');
That way you are explicit about what your log record is. Having a
default level makes no sense at all that I can see. The whole point of
levels is to be able to filter. If you want to rely on a default it
probably means you want to configure your logger to accept *all*
messages from DEBUG and up.
as was explained the reason is so that its possible to translate the message on display rather than on write. to be able to do this the static part of the message needs to be logged separately from the parameters.
On Dec 10, 2012, at 20:25 , Kirill Chebunin <i...@chebba.org> wrote:
> I will add a huge portion of critic. But this is PSR. It should be close to perfect for users and vendors.
>
> 1. I still can't understand what is the difference between
>
> $logger->debug('Some info with %parameter%', ['%parameter%' => $parameter]);
> and
> $logger->debug(sprintf('Some info with %s', $parameter), ['parameter' => $parameter]);
> This feature adds really small advantage, but will require an implementation in ALL libraries with the same simple code.
> 2. We have methods like error, warn, etc in the interface, so ALL libraries will have to implement this methods, but this methods will have the same code in 99.9% of situationsthis was also discussed before its simply more convenient for users to have separate methods and given the little effort it requires implementors to deal with this, it makes sense to tailor things to users of the API.
> public function error($message, array $context = [])
> {
> $this->log(LogLevel::ERROR, $message, $context);
> }
> More over a client code will expect such logic.
>
> So It's better to have an interface with 1 log($level, $message, array $context = array()) method and have a wrapper with placeholders, level shortcut methods etc. Than each library will implement only 1 main method.
i am not sure about the full pro's and con's here, but i prefer strings as the numbers on their own are meaningless which can become a problem inside configuration files. ie. if i configure a minimal log level i want to define it as a string rather than an integer. of course i could have some helper method that converts a string into an integer.
> 3. Log levels do not have any order. It's better to use default int values instead of strings from linked rfc
> 0 Emergency: system is unusable
> 1 Alert: action must be taken immediately
> 2 Critical: critical conditions
> 3 Error: error conditions
> 4 Warning: warning conditions
> 5 Notice: normal but significant condition
> 6 Informational: informational messages
> 7 Debug: debug-level messages
i think someone suggested adding a comparison method which accepts one of the strings, but i am really not sure. this again seems to me like something where going with strings its more tailored towards the ends of API users rather than implementors.
> 4. Log level class can have default Enum methods to get all values, or get value from name, etc.can you elaborate?
regards,
Lukas Kahwe Smith
m...@pooteeweet.org
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To post to this group, send email to php...@googlegroups.com.
To unsubscribe from this group, send email to php-fig+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To post to this group, send email to php...@googlegroups.com.
To unsubscribe from this group, send email to php-fig+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/php-fig/-/XZs-yP8QQO8J.
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To post to this group, send email to php...@googlegroups.com.
To unsubscribe from this group, send email to php-fig+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To post to this group, send email to php...@googlegroups.com.
To unsubscribe from this group, send email to php-fig+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
On 11.12.2012 14:01, Johannes Schmitt wrote:Thinking about it some more, I still don't really see the use case. It
> I've updated the proposal to remove the notion of custom levels, so now
> it's just some usability tool to compare the severity of the provided
> levels; shouldn't hurt.
does not benefit users as far as I can see, and implementors very likely
will already have some existing facilities for level sorting and the
easiest there is to just create a map: PSR level => internal level.
Evert
As it stands, I don't think placeholder delimiters "MUST" ;-) be part of the LoggerInterface proposal. I think they may be, and maybe even should be, but only after we do the research. In fact, in the interest of getting LoggerInterface out the door, I think it's perfectly acceptable to leave delimiters out of the proposal, then move directly to a delimiter proposal that will be the standard for *all* placeholder delimiters in strings, not just for logging.
As was discussed earlier in the thread, Drupal, Symfony fullstack,
ezPublish, and CakePHP are not the intended consumers for this
interface. Symfony Components, Guzzle, and Solarium are. Drupal,
ezPublish, and Cake will be providing objects of this interface TO those
libraries, which can then translate those placeholders to whatever
Drupal-specific or Cake-specific format they feel like. But Solarium
shouldn't have to think about such details.
--Larry Garfield