Giter Site home page Giter Site logo

Comments (3)

schveiguy avatar schveiguy commented on June 18, 2024

I've since discovered that the log is kind of cool because you can customize it. But not really.

In fact the part which does all the intelligence is a final function in the HTTPLogger interface. Why? I would like to fix the issue with the X-Forwarded-For (which I actually fixed by changing the format), plus add the user id who is logged in (specific to my application).

I was resigned to fixing this using a pre-process step, but the advantage of using the builtin logger is that it has access to what happened in the response.

Now, I'm thinking what we want is to reorganize this logger -- HTTPLogger should abstract not only the output of the string to the log file, but also the creation of the string. It would not be difficult to just add calls to the apache formatter in all the implementations. This allows hooking all parts of the logger given access to the request and the response.

from vibe.d.

s-ludwig avatar s-ludwig commented on June 18, 2024

I absolutely agree, HTTPLogger should be changed into an interface, with the option to later also support it as a statically typed compile time interface (as is the case for the stream types). I've never actually used the logging functionality, which is why it just stayed in that initial state.

Apart from that, I think the format string uses the Apache format (might also be Nginx, I don't remember), so it would make sense to take another look at that to see whether there are any extensions that would fit the bill here, while staying "standard" compatible. For the username part, we could probably allocate two unused letters and make the params and context fields available for logging custom fields.

from vibe.d.

schveiguy avatar schveiguy commented on June 18, 2024

make the params and context fields available for logging custom fields

I think that would be enough for my purposes. But in general, if we are to abstract the actual logging function, it needs access to all the things that are used by the apache formatter.

In the end, I just ended up not bothering with the log, because my vibe server is behind an apache proxy (which is already logging all this information).

from vibe.d.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.