Comments (3)
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.
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.
make the
params
andcontext
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)
- Can't build on (AWS ?) Linux HOT 3
- Unable to call the get method from the request form HOT 2
- Getting and sending JSON correctly HOT 1
- [Bug] Unable to call WebSocket.request._query.get() due to const HOT 1
- [CLOSED] How to deal with generated code via preBuildCommands? HOT 1
- Error when building on Raspberry Pi HOT 1
- notls has no effect
- build fails linking ssl - mac HOT 1
- Any way to write headers after response handler returns? HOT 2
- [bug] why "runWorkerTaskH" executes in same thread for multiple jobs/connections? HOT 2
- [vibe.d] WebSocket mess with "cast(shared) ..." HOT 1
- Proposal: remove whole Meson support at all HOT 11
- Regression #249 - failed to listen to address with default
- Invalid character in internet path. HOT 6
- How to get the client's MAC address in Vibe HOT 2
- Files are not uploaded using nested paths HOT 7
- Error on creating a mongo connection HOT 7
- Use Promises for REST JS clients
- an example email sent through Gmail HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vibe.d.