Some newbie questions: http-client, logging.
Piotr Klibert <[email protected]> Fri, 29 Aug 2014 16:38:07 +0200
| Newsgroups | gmane.comp.lang.dylan.gwydion.devel |
|---|---|
| Message-ID | <CAKQQ0av1pBhiF2t0Ced0cs39_SstJ1YKOevL5anmWmjO7+0ASw@mail.gmail.com> |
Hello list,
Following recent HN submissions about OpenDylan I decided to take a closer look
at the language. I wanted to learn it for a few years now, but when I last
checked (yeards ago) the documentation was severly lacking. I'm very glad this
improved.
The first thing I decided to write was a simple "make http request" script, as
usual for me. I encountered a couple of problems, which I'm sure you'll be able
to answer immediately, but which I wasn't able to figure out yet. I should
mention that I'm working with opendylan-2013.2-x86_64-linux from official
download page and with http library from https://github.com/dylan-lang/http
First, I'd like to get a list of headers out of response. I know I can check for
a specific header with
element(response.raw-headers, "connection", default: #f)
and that I can iterate over headers values with for, but I found no way of
getting the list of keys for <header-table>. I read bits of table.dylan, and
noticed <vector-table> class and further entry-key method, but these seem to be
internal and not exported.
Another thing: when the program terminates due to an error on runtime I get
error message, like for example:
"connection" is not present as a key for {<header-table>: size 1}.
but that's all I see. Compared to other languages I'm used to working with it's
ascetic, to say the least. I'm not asking for a full stacktrace, but a file and
line where the error originates would be a huge help already.
Further, when the program crashes, I see a
Breaking into debugger.
message. Am I correct in suspecting that this is something only available on
some platforms, and not available for me on Linux?
Another question involves logging. In http-common I noticed
define variable *debug-reads?* = #f;
- is there any way of setting this variable from my own code? This:
*debug-reads?* := #f;
doesn't work and the compiler complains about an undefined binding.
Similarly, in both http-client and http-common there are loggers defined, like
this:
define thread variable *http-common-log* :: <logger>
= make(<logger>,
name: "http.common",
targets: list($stdout-log-target),
level: $info-level);
how can I adjust the level of the loggers to something else than the default?
When I try to assign to *http-common-log*.level I get the error about the not
being level-setter, which makes me suspect that logger instances should be
immutable. But then I'm back to the previous question, where I can't reassign
module-level variable from outside the module...
Ok, that's it for now. I will probably come back with more questions soon :)
Best regards,
Piotr Klibert