@colisweb/rescript-toolkit 2.13.0 → 2.13.1
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/package.json
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
open BsSentry
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type t
|
|
4
|
+
@val external windowInstance: option<t> = "window"
|
|
5
|
+
@val external window: t = "window"
|
|
6
|
+
@val external process: t = "import.meta.env"
|
|
7
|
+
let get = () => Js.typeof(windowInstance) !== "undefined" ? window : process
|
|
8
|
+
let instance = get()
|
|
9
|
+
|
|
10
|
+
@get external _nodeEnv: t => string = "NODE_ENV"
|
|
11
|
+
|
|
12
|
+
let nodeEnv = instance->_nodeEnv
|
|
4
13
|
|
|
5
14
|
let debugStyle = "background-color: #208E9C; color: white; padding: 5px; font-size: 10px;"
|
|
6
15
|
let warningStyle = "background-color: #FFAD2D; color: white; padding: 5px; font-size: 10px;"
|
|
@@ -19,7 +28,7 @@ let debug2 = (str, str2) => {
|
|
|
19
28
|
}
|
|
20
29
|
let debug3 = (str, str2, str3) => {
|
|
21
30
|
if nodeEnv !== "production" {
|
|
22
|
-
Js.Console.logMany(["%cDEBUG", debugStyle, str, str2, str3])
|
|
31
|
+
Js.Console.logMany(["%cDEBUG", debugStyle, Obj.magic(str), Obj.magic(str2), Obj.magic(str3)])
|
|
23
32
|
}
|
|
24
33
|
}
|
|
25
34
|
|
|
@@ -63,30 +72,3 @@ let error2 = (str, str2) => {
|
|
|
63
72
|
})
|
|
64
73
|
}
|
|
65
74
|
}
|
|
66
|
-
|
|
67
|
-
let error3 = (str, str2, str3) => {
|
|
68
|
-
if nodeEnv !== "production" {
|
|
69
|
-
Js.Console.logMany(["%cERROR", errorStyle, str, str2, str3])
|
|
70
|
-
} else {
|
|
71
|
-
open Sentry
|
|
72
|
-
withScope(scope => {
|
|
73
|
-
scope->Scope.setExtra("1-data", str2)
|
|
74
|
-
scope->Scope.setExtra("2-data", str3)
|
|
75
|
-
captureMessage(Obj.magic(str))
|
|
76
|
-
})
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
let error4 = (str, str2, str3, str4) => {
|
|
81
|
-
if nodeEnv !== "production" {
|
|
82
|
-
Js.Console.logMany(["%cERROR", errorStyle, str, str2, str3, str4])
|
|
83
|
-
} else {
|
|
84
|
-
open Sentry
|
|
85
|
-
withScope(scope => {
|
|
86
|
-
scope->Scope.setExtra("1-data", str2)
|
|
87
|
-
scope->Scope.setExtra("2-data", str3)
|
|
88
|
-
scope->Scope.setExtra("3-data", str4)
|
|
89
|
-
captureMessage(Obj.magic(str))
|
|
90
|
-
})
|
|
91
|
-
}
|
|
92
|
-
}
|