aigoncharov / cls-proxify

Logging on steroids with CLS and Proxy. Integrated with express, koa, fastify.
MIT License
160 stars 7 forks source link

how to use with koa1 #12

Closed zcc19910524 closed 2 years ago

zcc19910524 commented 4 years ago

i use with koa1 like this but it only console 1 it seems clsProxifyKoaMiddleware is not worked

app.use(
    function *(next){
      console.log(1)
      clsProxifyKoaMiddleware(
         'clsKeyLogger',
         ctx => {
           console.log(2);
         }
       )
      yield next;
    }
  );
aigoncharov commented 2 years ago

@zcc19910524 the built-in middleware is for Koa v2. You could try building up the strategy outlined at https://github.com/aigoncharov/cls-proxify#any-other-framework-or-library or take a sneak peek at cls-rtracer.