Bug 550347 - Provide Platform.getLog(.class) method
Summary: Provide Platform.getLog(.class) method
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.13   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.13 RC1   Edit
Assignee: Lars Vogel CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on:
Blocks:
 
Reported: 2019-08-22 14:31 EDT by Lars Vogel CLA
Modified: 2019-08-26 07:44 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Vogel CLA 2019-08-22 14:31:48 EDT
To access the Platform log we currently support:

Bundle BUNDLE = FrameworkUtil.getBundle(SampleHandler.class);
ILog LOGGER = Platform.getLog(BUNDLE);

Lets make this easier by Platform.getLog(.class).
Comment 1 Lars Vogel CLA 2019-08-22 14:35:37 EDT
Christoph/ Jonas, please let me know what you think.
Comment 2 Eclipse Genie CLA 2019-08-22 14:35:52 EDT
New Gerrit change created: https://git.eclipse.org/r/148160
Comment 3 Jonas Hungershausen CLA 2019-08-22 14:38:33 EDT
Yes, this is awesome. Loggers are most convenient when accessed with a one-liner at the top of a file. Every extra line adds more code. I like it.
Comment 4 Alexander Fedorov CLA 2019-08-23 07:07:57 EDT
@Lars may be we can go one step further and provide

Platform.log(IStatus status, Class<?> clazz)
?
This will allow us to reduce the client code even more and also hide all the implementation details
Comment 5 Eclipse Genie CLA 2019-08-23 07:15:14 EDT
New Gerrit change created: https://git.eclipse.org/r/148216
Comment 6 Lars Vogel CLA 2019-08-23 07:18:43 EDT
(In reply to Alexander Fedorov from comment #4)
> @Lars may be we can go one step further and provide
> 
> Platform.log(IStatus status, Class<?> clazz)
> ?
> This will allow us to reduce the client code even more and also hide all the
> implementation details

Great idea. What about switching the arguments? Looks better to me.

Platform.log(Class<?> clazz, IStatus status)
Comment 8 Alexander Fedorov CLA 2019-08-23 07:42:00 EDT
(In reply to Lars Vogel from comment #6)
> (In reply to Alexander Fedorov from comment #4)
> > @Lars may be we can go one step further and provide
> > 
> > Platform.log(IStatus status, Class<?> clazz)
> > ?
> > This will allow us to reduce the client code even more and also hide all the
> > implementation details
> 
> Great idea. What about switching the arguments? Looks better to me.
> 
> Platform.log(Class<?> clazz, IStatus status)

I used to think that "clazz" argument may be optional but I'm OK with your order as well.
Comment 9 Lars Vogel CLA 2019-08-23 07:51:24 EDT
(In reply to Alexander Fedorov from comment #8)
> (In reply to Lars Vogel from comment #6)
> I used to think that "clazz" argument may be optional but I'm OK with your
> order as well.

Thanks, please review the Gerrit.
Comment 10 Lars Vogel CLA 2019-08-23 08:51:08 EDT
+1 by project lead
Comment 12 Eclipse Genie CLA 2019-08-23 08:58:52 EDT
New Gerrit change created: https://git.eclipse.org/r/148224
Comment 14 Eclipse Genie CLA 2019-08-23 09:14:54 EDT
New Gerrit change created: https://git.eclipse.org/r/148227
Comment 16 Lars Vogel CLA 2019-08-23 09:16:09 EDT
(In reply to Alexander Fedorov from comment #8)
> I used to think that "clazz" argument may be optional but I'm OK with your
> order as well.

As this method was controversial I removed it again. Lets find a better solution for 4.14.
Comment 17 Eclipse Genie CLA 2019-08-23 09:17:07 EDT
New Gerrit change created: https://git.eclipse.org/r/148228
Comment 19 Dani Megert CLA 2019-08-23 10:04:12 EDT
(In reply to Lars Vogel from comment #16)
> (In reply to Alexander Fedorov from comment #8)
> > I used to think that "clazz" argument may be optional but I'm OK with your
> > order as well.
> 
> As this method was controversial I removed it again. Lets find a better
> solution for 4.14.
Note that your change to pom.xml was wrong:
    <version>3.160.0-SNAPSHOT</version>
I've fixed that.
Comment 20 Dani Megert CLA 2019-08-23 10:05:19 EDT
(In reply to Dani Megert from comment #19)
> Note that your change to pom.xml was wrong:
You should install Releng Tools (https://download.eclipse.org/eclipse/downloads/drops4/S-4.13M3-201908211800/#org.eclipse.releng) which would warn you about mismatch between manifest and pom version.
Comment 21 Lars Vogel CLA 2019-08-23 10:15:04 EDT
(In reply to Dani Megert from comment #19)
> (In reply to Lars Vogel from comment #16)
> > (In reply to Alexander Fedorov from comment #8)
> > > I used to think that "clazz" argument may be optional but I'm OK with your
> > > order as well.
> > 
> > As this method was controversial I removed it again. Lets find a better
> > solution for 4.14.
> Note that your change to pom.xml was wrong:
>     <version>3.160.0-SNAPSHOT</version>
> I've fixed that.

Thanks, Dani.
Comment 22 Thomas Schindl CLA 2019-08-26 07:44:37 EDT
As noted in the other issue I'm not a huge fan of using/promoting/... useage of Platform-API.