外观
lib-log 库参考
原文: https://finproducts.atlassian.net/wiki/spaces/JIDD3/pages/34793390342/FIN+5.3.1+lib-log 中文整理基于 FIN 5.3.1
导读: 向日志子系统提交日志记录:
以下为 API 参考,保留英文以便对照源码;目录已列出(英文标题便于检索);概述已尽量中译。
目录(导读)
- lib
- meta
- funcs
- def
- log(level, tags, msg, err: null)
- logDebug(tags, msg, err: null)
- logErr(tags, msg, err: null)
- logInfo(tags, msg, err: null)
- logRead(span: Span.today(), filter: null, opts: null)
- logWarn(tags, msg, err: null)
概述(中译)
记录引擎
API 正文(英文)
funcs
| log | Submit a log record to the logging subsystem |
| logDebug | Log at the "debug" level - see log() |
| logErr | Log at the "err" level - see log() |
| logInfo | Log at the "info" level - see log() |
| logRead | Read log records for given span |
| logWarn | Log at the "warn" level - see log() |
def
func:log
log(level, tags, msg, err: null)
Submit a log record to the logging subsystem:
- level: must be "err", "warn", "info", "debug" (same as
LogLevel). - tags: Dict for
LogMod.createor Str which is assumed to be{name:<str>} - msg: short single line summary of message to log
- err: exception from catch block that includes errTrace tag
Best practice is to pass a SysMod/Ext name for the tags parameter, in which case the SysMod/Ext log is used. This allows you to manage the logging level via the Debug|Log view. If you pass an unknown library name or a Dict for tags then a temporary log instance is created, which cannot have its logging level configured.
Also see logErr(), logWarn(), logInfo(), and logDebug() .
Examples:
// use the host system module logger and current log level
log("info", "host", "something happened")
// convenience for previous
logInfo("host", "something happened")
// use the point extension logger and current log level
logErr("point", "something happened")
// log to my custom log - log level not configurable
logWarn("myOwnLog", "something happened")
// log to custom log name with additional tags
logWarn({name:"myOwnLog", user:"alice"}, "something happened")
/// example of logging with a stack trace
try throw "bad!" catch (e) logErr("task", "Failed", e)meta
| def | func:log |
| is | func |
| lib | lib:log |
| name | log |
supertypes
| feature | Feature namespace of definitions formatted as feature:name |
| func | Axon function |
def
func:logDebug
logDebug(tags, msg, err: null)
Log at the "debug" level - see log().
meta
| def | func:logDebug |
| is | func |
| lib | lib:log |
| name | logDebug |
supertypes
| feature | Feature namespace of definitions formatted as feature:name |
| func | Axon function |
def
func:logErr
logErr(tags, msg, err: null)
Log at the "err" level - see log().
meta
| def | func:logErr |
| is | func |
| lib | lib:log |
| name | logErr |
supertypes
| feature | Feature namespace of definitions formatted as feature:name |
| func | Axon function |
def
func:logInfo
logInfo(tags, msg, err: null)
Log at the "info" level - see log().
meta
| def | func:logInfo |
| is | func |
| lib | lib:log |
| name | logInfo |
supertypes
| feature | Feature namespace of definitions formatted as feature:name |
| func | Axon function |
def
func:logRead
logRead(span: Span.today(), filter: null, opts: null)
Read log records for given span. A non-null filter will be applied to the log records. Opts:
limit: max number of recs to return (default 10,000) NOTE: log reads for today cannot increase the limit past what is configured in Settings|Log for bufMax.
meta
| def | func:logRead |
| is | func |
| lib | lib:log |
| name | logRead |
| su | ✓ |
supertypes
| feature | Feature namespace of definitions formatted as feature:name |
| func | Axon function |
def
func:logWarn
logWarn(tags, msg, err: null)
Log at the "warn" level - see log().
meta
| def | func:logWarn |
| is | func |
| lib | lib:log |
| name | logWarn |
supertypes
| feature | Feature namespace of definitions formatted as feature:name |
| func | Axon function |