Re: Logger prefixes for api/apiserver are changing

2014-09-02 Thread Menno Smits
On 3 September 2014 15:07, Menno Smits  wrote:

>
>
> Also, when we talk about package paths we really mean the source tree path
> right? Every in cmd/juju is in the "main" package but uses a logger named
> "juju.cmd.juju". We can really use the real package name to set the logger
> name.
>

Urgh. s/can/can't/
-- 
Juju-dev mailing list
Juju-dev@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju-dev


Re: Logger prefixes for api/apiserver are changing

2014-09-02 Thread Menno Smits
On 3 September 2014 15:00, John Meinel  wrote:

> ...
>>
>> There were two ideas proposed:
>>
>> loggo.LoggerForPackage("juju")
>>
>> which would walk up the path until it found a path element juju, and
>> construct the string that way. The other was do use a defined prefix:
>>
>
> The only problem here is that we have:
>   github.com/juju/juju/juju
> and
>   github.com/juju/juju/cmd/juju
>
> Which would confuse this algorithm. Though I like its brevity.
>

Ha! I was just about to hit send on an email saying exactly the same thing
:)

Also, when we talk about package paths we really mean the source tree path
right? Every in cmd/juju is in the "main" package but uses a logger named
"juju.cmd.juju". We can really use the real package name to set the logger
name.

- Menno
-- 
Juju-dev mailing list
Juju-dev@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju-dev


Re: Logger prefixes for api/apiserver are changing

2014-09-02 Thread John Meinel
>
> ...
> There were two ideas proposed:
>
> loggo.LoggerForPackage("juju")
>
> which would walk up the path until it found a path element juju, and
> construct the string that way. The other was do use a defined prefix:
>

The only problem here is that we have:
  github.com/juju/juju/juju
and
  github.com/juju/juju/cmd/juju

Which would confuse this algorithm. Though I like its brevity.

John
=:->


>
> loggo.LoggerForPackage("github.com/juju")
>
> which would take what was after those path elements to generate the string.
>
>
> I'm happy with either being implemented, but would like feedback on the
> ideas.
>
-- 
Juju-dev mailing list
Juju-dev@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju-dev


Re: Logger prefixes for api/apiserver are changing

2014-09-02 Thread Tim Penhey
On 02/09/14 23:07, David Cheney wrote:
> Wow. I'm sorry I broke that, it didn't even occur to me.
> 
> I wonder if there is a better way to handle this default case of "the
> name of the logger follows the package path"), ie
> 
> var logger = loggo.Logger("") // or something, it could be a new
> method, logger.Default(), or something.
> 
> which will inspect the call tree and determine its logger name automagically.

I'm fine with this in theory, but the implementation is a little different.

The behaviour that we have right now is something akin to stripping off
the DVCS path, then replacing slashes for dots to get to the package.

So files that were in
  github.com/juju/juju/state/apiserver/...
used
  "juju.state.apiserver"

There were two ideas proposed:

loggo.LoggerForPackage("juju")

which would walk up the path until it found a path element juju, and
construct the string that way. The other was do use a defined prefix:

loggo.LoggerForPackage("github.com/juju")

which would take what was after those path elements to generate the string.


I'm happy with either being implemented, but would like feedback on the
ideas.

Tim

-- 
Juju-dev mailing list
Juju-dev@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju-dev


Re: Logger prefixes for api/apiserver are changing

2014-09-02 Thread David Cheney
I'll take thumper's temperature for this feature at the standup and
see what he thinks.

On Wed, Sep 3, 2014 at 12:30 AM, Eric Snow  wrote:
> On Tue, Sep 2, 2014 at 5:07 AM, David Cheney  
> wrote:
>> I wonder if there is a better way to handle this default case of "the
>> name of the logger follows the package path"), ie
>>
>> var logger = loggo.Logger("") // or something, it could be a new
>> method, logger.Default(), or something.
>>
>> which will inspect the call tree and determine its logger name automagically.
>
> +1
>
> -eric

-- 
Juju-dev mailing list
Juju-dev@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju-dev


Re: Logger prefixes for api/apiserver are changing

2014-09-02 Thread Eric Snow
On Tue, Sep 2, 2014 at 5:07 AM, David Cheney  wrote:
> I wonder if there is a better way to handle this default case of "the
> name of the logger follows the package path"), ie
>
> var logger = loggo.Logger("") // or something, it could be a new
> method, logger.Default(), or something.
>
> which will inspect the call tree and determine its logger name automagically.

+1

-eric

-- 
Juju-dev mailing list
Juju-dev@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju-dev


Re: Logger prefixes for api/apiserver are changing

2014-09-02 Thread David Cheney
Wow. I'm sorry I broke that, it didn't even occur to me.

I wonder if there is a better way to handle this default case of "the
name of the logger follows the package path"), ie

var logger = loggo.Logger("") // or something, it could be a new
method, logger.Default(), or something.

which will inspect the call tree and determine its logger name automagically.

On Tue, Sep 2, 2014 at 8:00 PM, Dimiter Naydenov
 wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hi,
>
> As you may already know, this pull request just landed today, moving
> state/api/ -> api/ and state/apiserver/ -> apiserver/ :
> https://github.com/juju/juju/pull/655
>
> It didn't fix the logger prefixes in some places, which I'm fixing
> with this follow-up: https://github.com/juju/juju/pull/659
>
> So be aware anything in the moved to top-level packages "api" and
> "apiserver" will use "juju.api.*" and "juju.apiserver.*" logger
> prefixes from now on (existing code will be converted as soon as #659
> lands, but for new code please follow the same pattern).
>
> Cheers!
> - --
> Dimiter Naydenov 
> juju-core team
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1
>
> iQEcBAEBAgAGBQJUBZUhAAoJENzxV2TbLzHwewkH/AhtPOv1h3w+9LkyQdmH7Pbl
> 28cucj422TOXIek65+tB4fGmeCglQTPJkaLcsImWxKhYU7oAP9iT52lKjHiV377t
> l7sSVprKWp1AfF307lT6xI8derNnoSJtEHTwbXZKc4LaQt60Zv/++yuc4xLu/zYJ
> z2rkypveSTfGrL7AqdoSsgmj1HbbO3uw9dlz17Mw96FuHsPZbOm28P+g3Y8FYjLR
> 4EBkZ+qHoUGl0dUV4hQyezFiY5H3SXPhqEIpm2ImPpj5MfNHPd1w7PHlPzXVcrkC
> WxWSzpdPsNhOi3AWGT9lwLaLkMA4emt/24exHHVifKFnzOy/Ob4Dr/QnYaB8zfM=
> =Mkd/
> -END PGP SIGNATURE-
>
> --
> Juju-dev mailing list
> Juju-dev@lists.ubuntu.com
> Modify settings or unsubscribe at: 
> https://lists.ubuntu.com/mailman/listinfo/juju-dev

-- 
Juju-dev mailing list
Juju-dev@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju-dev


Re: Logger prefixes for api/apiserver are changing

2014-09-02 Thread John Meinel
I just wanted to make sure that this makes it into the release notes, as it
is a semi-user-visible change.

John
=:->


On Tue, Sep 2, 2014 at 2:00 PM, Dimiter Naydenov <
dimiter.nayde...@canonical.com> wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hi,
>
> As you may already know, this pull request just landed today, moving
> state/api/ -> api/ and state/apiserver/ -> apiserver/ :
> https://github.com/juju/juju/pull/655
>
> It didn't fix the logger prefixes in some places, which I'm fixing
> with this follow-up: https://github.com/juju/juju/pull/659
>
> So be aware anything in the moved to top-level packages "api" and
> "apiserver" will use "juju.api.*" and "juju.apiserver.*" logger
> prefixes from now on (existing code will be converted as soon as #659
> lands, but for new code please follow the same pattern).
>
> Cheers!
> - --
> Dimiter Naydenov 
> juju-core team
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1
>
> iQEcBAEBAgAGBQJUBZUhAAoJENzxV2TbLzHwewkH/AhtPOv1h3w+9LkyQdmH7Pbl
> 28cucj422TOXIek65+tB4fGmeCglQTPJkaLcsImWxKhYU7oAP9iT52lKjHiV377t
> l7sSVprKWp1AfF307lT6xI8derNnoSJtEHTwbXZKc4LaQt60Zv/++yuc4xLu/zYJ
> z2rkypveSTfGrL7AqdoSsgmj1HbbO3uw9dlz17Mw96FuHsPZbOm28P+g3Y8FYjLR
> 4EBkZ+qHoUGl0dUV4hQyezFiY5H3SXPhqEIpm2ImPpj5MfNHPd1w7PHlPzXVcrkC
> WxWSzpdPsNhOi3AWGT9lwLaLkMA4emt/24exHHVifKFnzOy/Ob4Dr/QnYaB8zfM=
> =Mkd/
> -END PGP SIGNATURE-
>
> --
> Juju-dev mailing list
> Juju-dev@lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/juju-dev
>
-- 
Juju-dev mailing list
Juju-dev@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju-dev


Logger prefixes for api/apiserver are changing

2014-09-02 Thread Dimiter Naydenov
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

As you may already know, this pull request just landed today, moving
state/api/ -> api/ and state/apiserver/ -> apiserver/ :
https://github.com/juju/juju/pull/655

It didn't fix the logger prefixes in some places, which I'm fixing
with this follow-up: https://github.com/juju/juju/pull/659

So be aware anything in the moved to top-level packages "api" and
"apiserver" will use "juju.api.*" and "juju.apiserver.*" logger
prefixes from now on (existing code will be converted as soon as #659
lands, but for new code please follow the same pattern).

Cheers!
- -- 
Dimiter Naydenov 
juju-core team
-BEGIN PGP SIGNATURE-
Version: GnuPG v1

iQEcBAEBAgAGBQJUBZUhAAoJENzxV2TbLzHwewkH/AhtPOv1h3w+9LkyQdmH7Pbl
28cucj422TOXIek65+tB4fGmeCglQTPJkaLcsImWxKhYU7oAP9iT52lKjHiV377t
l7sSVprKWp1AfF307lT6xI8derNnoSJtEHTwbXZKc4LaQt60Zv/++yuc4xLu/zYJ
z2rkypveSTfGrL7AqdoSsgmj1HbbO3uw9dlz17Mw96FuHsPZbOm28P+g3Y8FYjLR
4EBkZ+qHoUGl0dUV4hQyezFiY5H3SXPhqEIpm2ImPpj5MfNHPd1w7PHlPzXVcrkC
WxWSzpdPsNhOi3AWGT9lwLaLkMA4emt/24exHHVifKFnzOy/Ob4Dr/QnYaB8zfM=
=Mkd/
-END PGP SIGNATURE-

-- 
Juju-dev mailing list
Juju-dev@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju-dev