send-sls-logger 0.0.42 → 0.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +38 -0
- package/lib/mini.d.ts +40 -0
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -23,10 +23,48 @@ interface initConfig {
|
|
|
23
23
|
export = slsLog;
|
|
24
24
|
export as namespace slsLog;
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* PC端sls日志组件,使用init初始化项目,填入 options(host、project、logstore);
|
|
28
|
+
* 在后续使用的时候,直接调用error|warn|log|into向sls发送日志
|
|
29
|
+
*/
|
|
26
30
|
declare namespace slsLog {
|
|
31
|
+
/**
|
|
32
|
+
* @name 发送error日志
|
|
33
|
+
* 接收两个参数,
|
|
34
|
+
* @param log string | StringObject
|
|
35
|
+
* @param format 整理即将发送的,返回要发送的日志结果
|
|
36
|
+
* */
|
|
27
37
|
function error(str: string | StringObject, format?: FormatResult): void;
|
|
38
|
+
/**
|
|
39
|
+
* @name 发送警告日志
|
|
40
|
+
* 接收两个参数,
|
|
41
|
+
* @param log string | StringObject
|
|
42
|
+
* @param format 整理即将发送的,返回要发送的日志结果
|
|
43
|
+
* */
|
|
28
44
|
function warn(str: string | StringObject, format?: FormatResult): void;
|
|
45
|
+
/**
|
|
46
|
+
* @name 发送普通日志
|
|
47
|
+
* 接收两个参数,
|
|
48
|
+
* @param log string | StringObject
|
|
49
|
+
* @param format 整理即将发送的,返回要发送的日志结果
|
|
50
|
+
* */
|
|
29
51
|
function log(str: string | StringObject, format?: FormatResult): void;
|
|
52
|
+
/**
|
|
53
|
+
* @name 发送普通日志
|
|
54
|
+
* 接收两个参数,
|
|
55
|
+
* @param log string | StringObject
|
|
56
|
+
* @param format 整理即将发送的,返回要发送的日志结果
|
|
57
|
+
* */
|
|
30
58
|
function info(str: string | StringObject, format?: FormatResult): void;
|
|
59
|
+
/**
|
|
60
|
+
* @name 初始化init
|
|
61
|
+
* @description 可以多次调用,在发送日志之前,一定要初始化过 options(host、project、logstore) 内容
|
|
62
|
+
* @param debug 是否开启debug模式
|
|
63
|
+
* @param defaultData 日志默认值,可以配置字符串或者function,如果是function,每次发送日志都会执行,通常用于获取当前页面的url等
|
|
64
|
+
* @param defaultExclude 设置关键字列表,用于排除一些日志,如果日志中包含配置的这些关键字,则不发送日志
|
|
65
|
+
* @param options host、project、logstore
|
|
66
|
+
* @param strMaxLength 是否开启debug模式 最大字符长度,如果关键字里包含token,则不进行截断
|
|
67
|
+
* @param userFormatResult 对最终发送的日志进行兜底处理,只能在init中使用
|
|
68
|
+
*/
|
|
31
69
|
function init(config: initConfig): void;
|
|
32
70
|
}
|
package/lib/mini.d.ts
CHANGED
|
@@ -6,7 +6,9 @@ interface StringObject {
|
|
|
6
6
|
/** 对最终发送的日志进行兜底处理,只能在init中使用 */
|
|
7
7
|
type FormatResult = (result: any) => any;
|
|
8
8
|
|
|
9
|
+
/** init 可以多次调用,最好在初次,填入 options 内容 */
|
|
9
10
|
interface initConfig {
|
|
11
|
+
/** 是否开启debug模式 */
|
|
10
12
|
debug?: boolean;
|
|
11
13
|
/** 日志默认值,可以配置字符串或者function,如果是function,每次发送日志都会执行,通常用于获取当前页面的url等 */
|
|
12
14
|
defaultData?: StringObject;
|
|
@@ -22,10 +24,48 @@ interface initConfig {
|
|
|
22
24
|
export = miniLog;
|
|
23
25
|
export as namespace miniLog;
|
|
24
26
|
|
|
27
|
+
/**
|
|
28
|
+
* 小程序日志,使用init初始化项目,填入 options(host、project、logstore),init可以多次调用,填入defaultData等默认信息;
|
|
29
|
+
* 在后续使用的时候,直接调用error|warn|log|into向sls发送日志
|
|
30
|
+
*/
|
|
25
31
|
declare namespace miniLog {
|
|
32
|
+
/**
|
|
33
|
+
* @name 发送error日志
|
|
34
|
+
* 接收两个参数,
|
|
35
|
+
* @param log string | StringObject
|
|
36
|
+
* @param format 整理即将发送的,返回要发送的日志结果
|
|
37
|
+
* */
|
|
26
38
|
function error(str: string | StringObject, format?: FormatResult): void;
|
|
39
|
+
/**
|
|
40
|
+
* @name 发送警告日志
|
|
41
|
+
* 接收两个参数,
|
|
42
|
+
* @param log string | StringObject
|
|
43
|
+
* @param format 整理即将发送的,返回要发送的日志结果
|
|
44
|
+
* */
|
|
27
45
|
function warn(str: string | StringObject, format?: FormatResult): void;
|
|
46
|
+
/**
|
|
47
|
+
* @name 发送普通日志
|
|
48
|
+
* 接收两个参数,
|
|
49
|
+
* @param log string | StringObject
|
|
50
|
+
* @param format 整理即将发送的,返回要发送的日志结果
|
|
51
|
+
* */
|
|
28
52
|
function log(str: string | StringObject, format?: FormatResult): void;
|
|
53
|
+
/**
|
|
54
|
+
* @name 发送普通日志
|
|
55
|
+
* 接收两个参数,
|
|
56
|
+
* @param log string | StringObject
|
|
57
|
+
* @param format 整理即将发送的,返回要发送的日志结果
|
|
58
|
+
* */
|
|
29
59
|
function info(str: string | StringObject, format?: FormatResult): void;
|
|
60
|
+
/**
|
|
61
|
+
* @name 初始化init
|
|
62
|
+
* @description 可以多次调用,在发送日志之前,一定要初始化过 options(host、project、logstore) 内容
|
|
63
|
+
* @param debug 是否开启debug模式
|
|
64
|
+
* @param defaultData 日志默认值,可以配置字符串或者function,如果是function,每次发送日志都会执行,通常用于获取当前页面的url等
|
|
65
|
+
* @param defaultExclude 设置关键字列表,用于排除一些日志,如果日志中包含配置的这些关键字,则不发送日志
|
|
66
|
+
* @param options host、project、logstore
|
|
67
|
+
* @param strMaxLength 是否开启debug模式 最大字符长度,如果关键字里包含token,则不进行截断
|
|
68
|
+
* @param userFormatResult 对最终发送的日志进行兜底处理,只能在init中使用
|
|
69
|
+
*/
|
|
30
70
|
function init(config: initConfig): void;
|
|
31
71
|
}
|