Giter VIP home page Giter VIP logo

log-proxy-server's People

Stargazers

 avatar

log-proxy-server's Issues

Rewrite settings implementation: Use predefined static configurations

Instead of passing the settings per request (too much overhead, too unconventional for documenting/implementing), we do the following

  • Optionally provide a json file with configuration groups by keys (so angular-project1 : ... would be a set of configuration that we can access through angular-project1 key, etc). These definitions live on the server and must be hardcoded into the application (NOT the repo)
  • The post route for logging has a parameter that will accept a configuration key string. If it's empty or it doesn't match a configuration, the default configuration will be used, otherwise we will extend the default configuration with the preconfigured key one.
  • Same for the get method to retrieve an effective configuration.

This is much better since it's very simple to implement on the client side (no extra parameters on the client side), has no overhead on the log requests, and basically makes sense since the server will usually take logging from a small set of applications that can be preconfigured instead of some random request that would need really dynamic configuration

Implement header-based configuration or token-based configuration

We need a way for a client to set the logging configuration once and that that will be used for all the calls within the session/or that use the given token. Easiest probably would be

  • Client provides logging configuration to server before first time it needs to log something (logging can be behind a promise that sends the configuration and afterwards adds the token to the header or something like that).

Alternatively:

  • Client appends the configuration in a header on each log call.

Alternatively:

  • Limited configuration through different endpoints (not good idea)

Use Winston's internal IoC container to add and retrieve preconfigured loggers

Instead of generating a new logger instance per request (which probably is bad performance-wise), now that we've moved to using predefined settings, we should use fixed loggers as Winston categories, and retrieve that to do the logging (if the logging is not there we initialize it the first time).

https://github.com/winstonjs/winston#working-with-multiple-loggers-in-winston

Update:

Perhaps it's best to initialize all the loggers based on all configurations all at once, then we can just use them. I don't think it should be such a hit in performance

Add integration test for logging service

Preparations

  • Setup testing environment

Tests:

  • Write test to check the settings route is returning the standard settings
  • Write tests by posting to the log service and checking that the calls send packages to the respective endpoints according to each configured transport

Add main log routes

We need to be able to handle json/form-multipart posts to the given endpoint.

Add swagger api for server route

Using Swagger official integration

https://github.com/swagger-api/swagger-node-express

This uses a swagger object where we insert definitions of the spec. Advantage seems to be that we can use for the errors the same code we would throw inside the methods. Bad thing is that it seems to couple the integration with swagger tightly into the controllers

Using jsdoc/yaml based documentation

https://www.npmjs.com/package/swagger-express

This one we add jsdoc comments to each controller route definition for example specifying the API for that endpoint

Update: No 2.0 support!

Use swagger tools:

https://www.npmjs.com/package/swagger-tools

https://github.com/apigee-127/swagger-tools/blob/master/docs/QuickStart.md

This basically uses the swagger spec as the defining document and injects a few pieces of middleware that add the swagger routes to the app (using connect middleware)

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.