https://github.com/ran-2012/winston-wrapper
A simple winston wrapper template.
https://github.com/ran-2012/winston-wrapper
Last synced: 10 months ago
JSON representation
A simple winston wrapper template.
- Host: GitHub
- URL: https://github.com/ran-2012/winston-wrapper
- Owner: ran-2012
- Created: 2020-06-28T06:20:09.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-07-14T13:08:32.000Z (about 3 years ago)
- Last Synced: 2025-01-10T16:53:57.545Z (over 1 year ago)
- Language: TypeScript
- Size: 29.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# winston-wrapper
This is a "copy-and-use" sample to make you using `winston` easier.
## How to use?
- Add related packages to your package.json:
Just copy this and append to your `dependencied` of `package.json`.
```text
"@types/node": "^14.0.14",
"@types/winston": "^2.4.4",
"typescript": "^3.9.5",
"winston": "^3.3.3",
"winston-daily-rotate-file": "^4.5.0"
```
- If you are using TypeScript
Great! just copy `log.ts` and `config.ts` to your project's directory.
Here is the sample code:
```typescript
import {getLogger} from './log';
const log = getLogger('test');
log.warn("this is a warning.");
log.error(new Error("Here is a error."));
log.info("Time to go.", "It's now", 12, "a.m.");
```
- If you are using JavaScript
Compiled js files can be found in `./build`, you can copy these to .js files.
But things may go wrong, I didn't test if it works using `require`.