Re: [Twisted-Python] buildbot.twistedmatrix.com is down?

2018-01-05 Thread Craig Rodrigues
Thanks for rebooting it.

The egh-osx-1 node seems to be down though:

https://buildbot.twistedmatrix.com/builders/osx10.10-py2.7

and this node is a blocking requirement for merges to take place.

--
Craig


On Thu, Jan 4, 2018 at 2:58 AM, Glyph  wrote:

>
>
> On Jan 3, 2018, at 6:12 PM, Craig Rodrigues 
> wrote:
>
> Hi,
>
> It looks like buildbot.twistedmatrix.com is down.
> Does anyone know how to bring it back?
>
>
> I've rebooted it, applied security updates, rebooted, purged old kernels,
> rebooted again.  Should be running smoothly now, no idea what the issue was.
>
> Anyone else with access to do this sort of thing should feel free, by the
> way, it was a bit of a fluke that I had a moment of free time to do so
> tonight :-).
>
> -g
>
>
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] stdlib logger, loggerFor and filtering events

2018-01-05 Thread Felipe Dau
As the logger has been brought up, I'd like to ask a couple things:

1) When I was working on adding logs to an application, I wanted it to
use both the `textFileLogObserver` and the `STDLibLogObserver`. As the
application could be used either with its CLI or GUI, it seemed
interesting to have both these loggers available. I was able to do
that but I wanted them to have the same format - specifically, I
wanted to use the file's format (which is awesome btw) - and had to
override some parts of the `STDLibLogObserver`. It would have made
things a lot simpler if that observer accepted a function to format
events like the `FileLogObserver`.

2) Why is `_loggerFor` "private/hidden"? That is a great factory which
imo should have more visibility - and also works great with attrs!:

 attr.ib(default=attr.Factory(_loggerFor, takes_self=True))

3) Is there a way to suppress logs from libs or any other code that
is not your own? In my case, I had to manually set which namespaces
I wanted to filter but, for example, when you subclass a third-party's
class which logs something, that will pass because now it belongs to
one of your namespaces. I know it sounds crazy but wanted to know what
other people think.

If any of these changes sound like they would be useful apart from the
specific requirements of that application, I could help implement
something based on what I wrote [0].

Thanks,
-Felipe

[0]: https://github.com/AnemoneLabs/unmessage/blob/develop/unmessage/log.py

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] buildbot.twistedmatrix.com is down?

2018-01-05 Thread Glyph


> On Jan 5, 2018, at 10:04 AM, Craig Rodrigues  wrote:
> 
> Thanks for rebooting it.
> 
> The egh-osx-1 node seems to be down though:
> 
> https://buildbot.twistedmatrix.com/builders/osx10.10-py2.7 
> 
> 
> and this node is a blocking requirement for merges to take place.

Thanks for the report; rebooted and security updates applied; it appears to be 
processing the backlog just fine now.

-glyph___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] stdlib logger, loggerFor and filtering events

2018-01-05 Thread Glyph


> On Jan 5, 2018, at 7:11 PM, Felipe Dau  wrote:
> 
> As the logger has been brought up, I'd like to ask a couple things:


Just for the record, you don't need to wait for it to be brought up before 
asking other questions ;-).

> 1) When I was working on adding logs to an application, I wanted it to
> use both the `textFileLogObserver` and the `STDLibLogObserver`. As the
> application could be used either with its CLI or GUI, it seemed
> interesting to have both these loggers available. I was able to do
> that but I wanted them to have the same format - specifically, I
> wanted to use the file's format (which is awesome btw) - and had to
> override some parts of the `STDLibLogObserver`. It would have made
> things a lot simpler if that observer accepted a function to format
> events like the `FileLogObserver`.

It might be cool to add that, but, if you don't want the standard library's log 
format, why are you using the standard library log observer?  And wouldn't this 
be a job for a 
https://docs.python.org/3.6/library/logging.html#logging.Formatter 
 object in 
any case; what Twisted should be doing is sending the logs on in a more 
structured format that works with that?

> 2) Why is `_loggerFor` "private/hidden"? That is a great factory which
> imo should have more visibility - and also works great with attrs!:
> 
> attr.ib(default=attr.Factory(_loggerFor, takes_self=True))

I'm honestly not sure why this exists at all.  It seems like a terrible mistake 
has happened here, since `_loggerFor` is actually exported in __all__, which 
should never ever happen.

From what I can tell, it should be removed, since rather than creating that 
fairly noisy attr.ib() definition, you could do this:

_log = Logger()

which is a lot more succinct, and has exactly the same effect (do 
`self._log.info (...)`) and there you have it.

If you could explain why it's great, then maybe we could remove the underscore 
and add it to the docs.

> 3) Is there a way to suppress logs from libs or any other code that
> is not your own? In my case, I had to manually set which namespaces
> I wanted to filter but, for example, when you subclass a third-party's
> class which logs something, that will pass because now it belongs to
> one of your namespaces. I know it sounds crazy but wanted to know what
> other people think.

Absolutely!  Super glad you brought this up. This was a major part of the 
design of the new logging system, both to do this, and to also do as little 
work as possible with messages that were ultimately caught by such filters.

Here's a quick example program demonstrating the combination of 
https://twistedmatrix.com/documents/17.9.0/api/twisted.logger.LogLevelFilterPredicate.html
 

 and 
https://twistedmatrix.com/documents/17.9.0/api/twisted.logger.FilteringLogObserver.html
 
.

import sys
from twisted.logger import (Logger, FilteringLogObserver,
LogLevelFilterPredicate, globalLogBeginner,
LogLevel, textFileLogObserver)

alog = Logger(namespace="a")
blog = Logger(namespace="b")

predicate = LogLevelFilterPredicate()
predicate.setLogLevelForNamespace("a", LogLevel.debug)
predicate.setLogLevelForNamespace("b", LogLevel.warn)

globalLogBeginner.beginLoggingTo(
[FilteringLogObserver(textFileLogObserver(sys.stdout), [predicate])]
)

alog.info("one")
blog.info("two")
alog.critical("three")
blog.critical("four")


> If any of these changes sound like they would be useful apart from the
> specific requirements of that application, I could help implement
> something based on what I wrote [0].

We'd certainly be interested in contributions to the logging subsystem!  But 
I'd probably want to hear a little more about how and why you thought these 
things were useful first.

-g

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python