log/README.md
2024-10-12 16:55:50 +08:00

33 lines
1.0 KiB
Markdown

# log for GoJS
## set log config in env.yml
```yaml
log:
level: info # specify the log level (error/warning/info/debug), default: info
file: out.log # specify the log file, default logs to standard output
splitTag: 20060102 # log file split format, refer to Golang date time format syntax, default does not split
sensitive: phone,password,secret,token,accessToken # fields to be desensitized in logs, separated by commas. The matching values in requests, responses, HTTP headers, and request/response JSON data indices will be desensitized
```
### more config see [ssgo/log](https://github.com/ssgo/log)
## example
```javascript
import log from 'apigo.cc/gojs/log'
log.info('hello world')
log.error('some error', {name: 'abc'})
```
## module.exports
```ts
function debug(message:string, info?:Object): void {}
function info(message:string, info?:Object): void {}
function warn(message:string, info?:Object): void {}
function error(message:string, info?:Object): void {}
```
## full api see [log.ts](https://apigo.cc/gojs/log/log.ts)