Comments (11)
Yes! We need logging. We would really welcome your help in implementing it.
from wafer.
Here is the log format I will use. It will contain as much information that is parsed from the request. I am going to try and finish it this weekend.
from wafer.
Sweet. Let me know if you need any help. Meanwhile, I am trying to improve the throughput of the platform.
from wafer.
I implemented some very basic logging in my fork. The only problem I had was dealing with statuses other than 200. It looks like the code now sends a 200 and then checks to see if the file or "resource" exists and if it doesn't sends a 404 on top of the existing 200 it sent. Is this a bug?
from wafer.
Good question.
Write now, the status codes are handled entirely by server(). As such, nope.c itself has no idea about the status codes, because server doesn't return anything. One thing we could do is make server() return a status code, which then your logger could use.
What do you think?
from wafer.
That sounds great. Unless you foresee wanting to return anything form server() in the future, a status code would be really helpful without having to change too much of the code now.
from wafer.
The only problem is, there's no way to enforce return values in C.
from wafer.
Oh I see, considering that there is a chance that multiple functions may return different values at different times. I will see if I can find an alternative.
from wafer.
Until there is a way to successfully get return values, I don't know how we can go about logging them. For now all I can log is a request, the ip, and a time stamp.
from wafer.
I agree with @gsquire. A status code is really helpful and should be compulsory.
One more problem with logging involves the multithreaded model introduced in version 0.0.4 alpha.
Should the logger be run by the main thread (in cleaner() for example) or by worker threads?
from wafer.
If you look at the 0.0.5 branch, I have made some significant changes to support what you are looking for:
the server function now takes the form server(Request * request, Response response )
Response is a struct in the form of
typedef struct struct_response {
int fd;
char **headers;
int flags;
int apiFlags;
int status;
} Response;
nopeapi sendHeader family of functions will automatically set the status. Or the users could change it somewhere in the server
function. Either way, you can now check the Response.status
upon return to get the status.
from wafer.
Related Issues (20)
- Who needs a web framework written under GPL terms anyway HOT 5
- Really a use for select() ? HOT 5
- Building on OS X fails HOT 3
- support other multiplexing I/O methods? HOT 4
- Better non-blocking socket reading
- TCP_CORK is Linux-specific, need to #ifdef it as such HOT 1
- Integer overflow in array allocations HOT 1
- Why not use dprintf instead of nprintf? HOT 1
- nope.c:77 - Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'char *' HOT 1
- nope.c architecture HOT 3
- need a automatically expandable buffer?
- check send buf before sending data? HOT 1
- repeat code HOT 1
- Is there a standard function to handle 404? HOT 2
- Load Test Failed HOT 3
- AF-Unix HOT 1
- Some clean up
- README needs info on size of WAFer
- Completion of error handling
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 wafer.