gcanti / logging-ts

Composable loggers for TypeScript
https://gcanti.github.io/logging-ts/
MIT License
98 stars 8 forks source link

[feat] withLogger #21

Closed waynevanson closed 4 years ago

waynevanson commented 4 years ago

I can't figure how to implement MonadIO2C and MonadIO3, which is why there aren't any tests.

Now jest closes, but running npm test results in a typescript parsing errors because the example in the comments is being parsed. This looks to be the case because of the docs generator.

What do you recommend be done about this?

closes #20

gcanti commented 4 years ago

results in a typescript parsing error

I think there's a missing ) at the end of programWithLogging's pipe

waynevanson commented 4 years ago

@gcanti All your review changes have been added.

The issue I'm seeing during build time is still with docs-ts. It errors because read is not defined, even though it's been declared.

Any ideas on how to get around this?

/home/wayne/Documents/code/forks/logging-ts/docs/examples/src-IO.ts-withLogger-0.ts:13
export const program = pipe(
                       ^
ReferenceError: read is not defined
    at Object.<anonymous> (/home/wayne/Documents/code/forks/logging-ts/docs/examples/src-IO.ts-withLogger-0.ts:13:24)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Module.m._compile (/home/wayne/Documents/code/forks/logging-ts/node_modules/ts-node/src/index.ts:814:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Object.require.extensions.<computed> [as .ts] (/home/wayne/Documents/code/forks/logging-ts/node_modules/ts-node/src/index.ts:817:12)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/home/wayne/Documents/code/forks/logging-ts/docs/examples/index.ts:1:1)
Type checking error
gcanti commented 4 years ago

@waynevanson that's because during the docs generation the examples are type-checked and executed, since read, parse, reverse and write are just declared, it errors out

waynevanson commented 4 years ago

@gcanti wow that's next level documentation.

I'll add an implementation.

waynevanson commented 4 years ago

As useful as the example is, it's pretty bulky.

I wouldn't mind getting rid of the example and add it in later.

I'll delete it all then request a review.

waynevanson commented 4 years ago

@gcanti Thank you for your patience. How does this look?

gcanti commented 4 years ago

Thanks @waynevanson