@protoqol/vivid-log 2.0.0
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/.github/CHANGELOG +12 -0
- package/.github/LICENSE +21 -0
- package/.github/workflows/publish.yml +38 -0
- package/README.md +201 -0
- package/dist/lib/ansi.d.ts +25 -0
- package/dist/lib/ansi.js +49 -0
- package/dist/lib/ansi.js.map +1 -0
- package/dist/lib/config/config.d.ts +18 -0
- package/dist/lib/config/config.js +44 -0
- package/dist/lib/config/config.js.map +1 -0
- package/dist/lib/enums.d.ts +13 -0
- package/dist/lib/enums.js +29 -0
- package/dist/lib/enums.js.map +1 -0
- package/dist/lib/methods.d.ts +3 -0
- package/dist/lib/methods.js +35 -0
- package/dist/lib/methods.js.map +1 -0
- package/dist/lib/utils.d.ts +34 -0
- package/dist/lib/utils.js +224 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/vividLog.d.ts +51 -0
- package/dist/lib/vividLog.js +116 -0
- package/dist/lib/vividLog.js.map +1 -0
- package/dist/test/test.d.ts +1 -0
- package/dist/test/test.js +112 -0
- package/dist/test/test.js.map +1 -0
- package/dist/vividLog.js +2 -0
- package/dist/vividLog.js.map +1 -0
- package/lib/ansi.ts +47 -0
- package/lib/config/config.ts +68 -0
- package/lib/enums.ts +35 -0
- package/lib/methods.ts +32 -0
- package/lib/utils.ts +271 -0
- package/lib/vividLog.ts +134 -0
- package/package.json +42 -0
- package/test/test.ts +88 -0
- package/tsconfig.json +25 -0
- package/webpack.config.js +29 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
* 1.3.0
|
|
2
|
+
* Added support to log multiple variables
|
|
3
|
+
* Added ability to group variables
|
|
4
|
+
* Readme update
|
|
5
|
+
* 1.0.0
|
|
6
|
+
* The first release, it's now working and can be used.
|
|
7
|
+
* 0.9.0
|
|
8
|
+
* Added the actual code; v.err() / v.debug() / v.log() / v.done() / v.warn() / v.info() / v.say()
|
|
9
|
+
* Added option to configure some settings
|
|
10
|
+
* Added semi-support for FireFox
|
|
11
|
+
* 0.0.2
|
|
12
|
+
* Work in progress
|
package/.github/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Protoqol
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Node.js CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ "main" ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ "main" ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
node-version: [ 20.x, 22.x, 25.x ]
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
18
|
+
uses: actions/setup-node@v4
|
|
19
|
+
with:
|
|
20
|
+
node-version: ${{ matrix.node-version }}
|
|
21
|
+
cache: 'npm'
|
|
22
|
+
- run: npm ci
|
|
23
|
+
- run: npm test
|
|
24
|
+
publish:
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
needs: build
|
|
27
|
+
environment: publishing
|
|
28
|
+
permissions:
|
|
29
|
+
contents: read
|
|
30
|
+
id-token: write
|
|
31
|
+
steps:
|
|
32
|
+
- uses: actions/checkout@v4
|
|
33
|
+
- uses: actions/setup-node@v4
|
|
34
|
+
with:
|
|
35
|
+
node-version: '25.x'
|
|
36
|
+
- run: npm ci
|
|
37
|
+
- run: npm run build
|
|
38
|
+
- run: npm publish
|
package/README.md
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
> Ever thought the native console logging feature could be better?
|
|
7
|
+
|
|
8
|
+
This npm module makes it slightly easier but mainly a lot nicer to log to the browser console and terminal.
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- **TypeScript Native**: Written in TypeScript with full type definitions.
|
|
13
|
+
- **Cross-Environment**: Automatic detection and support for both Browser and Node.js.
|
|
14
|
+
- **Beautiful Styles**: CSS-styled logs in browsers and ANSI-styled logs in terminals.
|
|
15
|
+
- **Grouping**: Auto-grouping of multiple logs for better organization.
|
|
16
|
+
- **Customizable**: Flexible configuration for colors, timestamps, and font sizes.
|
|
17
|
+
- **Takeover**: Ability to catch global errors and log them vividly.
|
|
18
|
+
|
|
19
|
+
## Table of Contents
|
|
20
|
+
|
|
21
|
+
- [Installation](#installation--usage)
|
|
22
|
+
- [Usage](#usage)
|
|
23
|
+
- [Available Methods](#available-methods)
|
|
24
|
+
- [Configuration](#configuration)
|
|
25
|
+
- [Environment Support](#environment-support)
|
|
26
|
+
- [Preview](#preview)
|
|
27
|
+
- [Release History](#release-history)
|
|
28
|
+
|
|
29
|
+
## Installation & Usage
|
|
30
|
+
|
|
31
|
+
#### Install with npm
|
|
32
|
+
|
|
33
|
+
Installation is as simple as any other npm module.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm i @protoqol/vivid-log
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
#### Install with CDN
|
|
40
|
+
|
|
41
|
+
Or add this to your HTML file directly:
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
|
|
45
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@protoqol/vivid-log@latest/dist/vividLog.js"></script>
|
|
46
|
+
|
|
47
|
+
<script>
|
|
48
|
+
// Access via global window object
|
|
49
|
+
const v = window.vividLog;
|
|
50
|
+
v.done("VividLog is ready!");
|
|
51
|
+
</script>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Usage
|
|
55
|
+
|
|
56
|
+
#### Available Methods
|
|
57
|
+
|
|
58
|
+
VividLog supports both ES modules (`import`) and traditional script tags (Global variable).
|
|
59
|
+
|
|
60
|
+
- **In Browsers**: It is automatically bound to `window.vividLog`.
|
|
61
|
+
- **In Node.js**: It is automatically bound to `global.vividLog`.
|
|
62
|
+
|
|
63
|
+
##### ES Modules (Modern Web / Node.js)
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
import v from '@protoqol/vivid-log';
|
|
67
|
+
|
|
68
|
+
v.log('Regular log');
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
##### Global Variable (CDN / Traditional Script)
|
|
72
|
+
|
|
73
|
+
If you are using the CDN version, you don't need to import anything. Use `vividLog` directly:
|
|
74
|
+
|
|
75
|
+
```javascript
|
|
76
|
+
vividLog.info('Information message via global variable');
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
##### Grouping & Multiple Arguments
|
|
80
|
+
|
|
81
|
+
Log multiple variables together or group them under a single label.
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
// Log multiple items (they will be auto-grouped)
|
|
85
|
+
v.log('User Data:', {id: 1, name: 'John'}, ['Admin', 'Developer']);
|
|
86
|
+
|
|
87
|
+
// Manually group the next log call
|
|
88
|
+
v.group().log('Category A', 'Category B', 'Category C');
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
##### Custom Styling & Utilities
|
|
92
|
+
|
|
93
|
+
Methods for custom branding and behavior.
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
// Custom log with label and hex color
|
|
97
|
+
v.say('My Variable', 'A Nice Label', '#795548');
|
|
98
|
+
|
|
99
|
+
// Just fire a label without content
|
|
100
|
+
v.fireLabel('PROCESS STARTED');
|
|
101
|
+
|
|
102
|
+
// Inject custom CSS (Browser only)
|
|
103
|
+
v.style('font-style: italic; font-weight: bold;').log('Stylish text!');
|
|
104
|
+
|
|
105
|
+
// Catch all global uncaught exceptions/errors
|
|
106
|
+
v.takeOver(true);
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Configuration
|
|
110
|
+
|
|
111
|
+
Configure the library by accessing the `config` property.
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
import v from "@protoqol/vivid-log";
|
|
115
|
+
|
|
116
|
+
v.config.autoGroup = false;
|
|
117
|
+
v.config.fontSize = "14px";
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
#### Available Config Options
|
|
121
|
+
|
|
122
|
+
| Property | Type | Default | Description |
|
|
123
|
+
|:-----------------|:----------|:----------|:--------------------------------------------------------------------------|
|
|
124
|
+
| `autoGroup` | `boolean` | `true` | Automatically group multiple arguments into a collapsed console group. |
|
|
125
|
+
| `timeNotation` | `string` | `"h:m:s"` | Format for the timestamp. |
|
|
126
|
+
| `iUseLightTheme` | `boolean` | `false` | Adjusts text colors for better visibility on light console themes. |
|
|
127
|
+
| `customStyle` | `string` | `""` | Global CSS style applied to all logs (Browser only). |
|
|
128
|
+
| `fontSize` | `string` | `"12px"` | Font size for console logs (Browser only). |
|
|
129
|
+
| `newLine` | `boolean` | `false` | Whether to put the log content on a new line (default `true` on Firefox). |
|
|
130
|
+
| `status` | `object` | ... | Mapping of log levels to their respective colors and codes. |
|
|
131
|
+
|
|
132
|
+
## Environment Support
|
|
133
|
+
|
|
134
|
+
#### Browser
|
|
135
|
+
|
|
136
|
+
Fully supported with CSS-styled logging in Chrome, Firefox, and Opera.
|
|
137
|
+
|
|
138
|
+
#### Node.js / Terminal
|
|
139
|
+
|
|
140
|
+
Fully supported with ANSI color-styled logging. VividLog automatically detects the environment and applies the
|
|
141
|
+
appropriate styling.
|
|
142
|
+
|
|
143
|
+
## Preview
|
|
144
|
+
|
|
145
|
+
#### What you can expect
|
|
146
|
+
|
|
147
|
+

|
|
148
|
+
|
|
149
|
+
#### Without grouping and with grouping
|
|
150
|
+
|
|
151
|
+

|
|
152
|
+
|
|
153
|
+
#### Expanded group
|
|
154
|
+
|
|
155
|
+

|
|
156
|
+
|
|
157
|
+
#### What your error log looks like after using `v.takeover()`
|
|
158
|
+
|
|
159
|
+

|
|
160
|
+
|
|
161
|
+
## Release History
|
|
162
|
+
|
|
163
|
+
* 2.0.0
|
|
164
|
+
* Converted the entire library to **TypeScript**.
|
|
165
|
+
* Added full **Node.js / Terminal** support with ANSI colors.
|
|
166
|
+
* Modernized code to ES2026 standards.
|
|
167
|
+
* Improved type detection for variables (e.g., `object[3]`, `array[5]`, `error`).
|
|
168
|
+
* Fixed `v.takeOver()` for Node.js (`uncaughtException`).
|
|
169
|
+
* Updated build system to use Webpack 5 and TypeScript.
|
|
170
|
+
* 1.5.0
|
|
171
|
+
* Added new method called `v.style()` in which you can define your own log style
|
|
172
|
+
* A lot of refactoring of the code, less chaos more nice code
|
|
173
|
+
* 1.3.15
|
|
174
|
+
* `v.takeover()` renamed to `v.takeOver()`
|
|
175
|
+
* New sample images
|
|
176
|
+
* Readme fixes and updates
|
|
177
|
+
* 1.3.0
|
|
178
|
+
* Added support to log multiple variables
|
|
179
|
+
* Added ability to group variables
|
|
180
|
+
* 1.0.0
|
|
181
|
+
* The first release, it's now working and can be used.
|
|
182
|
+
* 0.9.0
|
|
183
|
+
* Added the actual code; v.err() / v.debug() / v.log() / v.done() / v.warn() / v.info() / v.say()
|
|
184
|
+
* Added option to configure some settings
|
|
185
|
+
* Added semi-support for FireFox
|
|
186
|
+
* 0.0.2
|
|
187
|
+
* Work in progress
|
|
188
|
+
|
|
189
|
+
## Tested on Chrome / Firefox / Opera
|
|
190
|
+
|
|
191
|
+
> If anyone could share some experiences with other browsers with me I would be very thankful!
|
|
192
|
+
|
|
193
|
+
## Meta
|
|
194
|
+
|
|
195
|
+
Distributed under the MIT license. See ``LICENSE`` for more information.
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
Developed by [Protoqol](https://protoqol.nl/).
|
|
200
|
+
|
|
201
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const ANSI: {
|
|
2
|
+
reset: string;
|
|
3
|
+
bold: string;
|
|
4
|
+
italic: string;
|
|
5
|
+
underline: string;
|
|
6
|
+
inverse: string;
|
|
7
|
+
black: string;
|
|
8
|
+
red: string;
|
|
9
|
+
green: string;
|
|
10
|
+
yellow: string;
|
|
11
|
+
blue: string;
|
|
12
|
+
magenta: string;
|
|
13
|
+
cyan: string;
|
|
14
|
+
white: string;
|
|
15
|
+
bgBlack: string;
|
|
16
|
+
bgRed: string;
|
|
17
|
+
bgGreen: string;
|
|
18
|
+
bgYellow: string;
|
|
19
|
+
bgBlue: string;
|
|
20
|
+
bgMagenta: string;
|
|
21
|
+
bgCyan: string;
|
|
22
|
+
bgWhite: string;
|
|
23
|
+
};
|
|
24
|
+
export declare const hexToAnsi: (hex: string) => string;
|
|
25
|
+
export declare const hexToAnsiBg: (hex: string) => string;
|
package/dist/lib/ansi.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hexToAnsiBg = exports.hexToAnsi = exports.ANSI = void 0;
|
|
4
|
+
exports.ANSI = {
|
|
5
|
+
reset: "\x1b[0m",
|
|
6
|
+
bold: "\x1b[1m",
|
|
7
|
+
italic: "\x1b[3m",
|
|
8
|
+
underline: "\x1b[4m",
|
|
9
|
+
inverse: "\x1b[7m",
|
|
10
|
+
black: "\x1b[30m",
|
|
11
|
+
red: "\x1b[31m",
|
|
12
|
+
green: "\x1b[32m",
|
|
13
|
+
yellow: "\x1b[33m",
|
|
14
|
+
blue: "\x1b[34m",
|
|
15
|
+
magenta: "\x1b[35m",
|
|
16
|
+
cyan: "\x1b[36m",
|
|
17
|
+
white: "\x1b[37m",
|
|
18
|
+
bgBlack: "\x1b[40m",
|
|
19
|
+
bgRed: "\x1b[41m",
|
|
20
|
+
bgGreen: "\x1b[42m",
|
|
21
|
+
bgYellow: "\x1b[43m",
|
|
22
|
+
bgBlue: "\x1b[44m",
|
|
23
|
+
bgMagenta: "\x1b[45m",
|
|
24
|
+
bgCyan: "\x1b[46m",
|
|
25
|
+
bgWhite: "\x1b[47m",
|
|
26
|
+
};
|
|
27
|
+
const hexToAnsi = (hex) => {
|
|
28
|
+
hex = hex.replace(/^#/, "");
|
|
29
|
+
if (hex.length === 3) {
|
|
30
|
+
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
31
|
+
}
|
|
32
|
+
const r = parseInt(hex.substring(0, 2), 16);
|
|
33
|
+
const g = parseInt(hex.substring(2, 4), 16);
|
|
34
|
+
const b = parseInt(hex.substring(4, 6), 16);
|
|
35
|
+
return `\x1b[38;2;${r};${g};${b}m`;
|
|
36
|
+
};
|
|
37
|
+
exports.hexToAnsi = hexToAnsi;
|
|
38
|
+
const hexToAnsiBg = (hex) => {
|
|
39
|
+
hex = hex.replace(/^#/, "");
|
|
40
|
+
if (hex.length === 3) {
|
|
41
|
+
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
42
|
+
}
|
|
43
|
+
const r = parseInt(hex.substring(0, 2), 16);
|
|
44
|
+
const g = parseInt(hex.substring(2, 4), 16);
|
|
45
|
+
const b = parseInt(hex.substring(4, 6), 16);
|
|
46
|
+
return `\x1b[48;2;${r};${g};${b}m`;
|
|
47
|
+
};
|
|
48
|
+
exports.hexToAnsiBg = hexToAnsiBg;
|
|
49
|
+
//# sourceMappingURL=ansi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ansi.js","sourceRoot":"","sources":["../../lib/ansi.ts"],"names":[],"mappings":";;;AAAa,QAAA,IAAI,GAAG;IAChB,KAAK,EAAM,SAAS;IACpB,IAAI,EAAO,SAAS;IACpB,MAAM,EAAK,SAAS;IACpB,SAAS,EAAE,SAAS;IACpB,OAAO,EAAI,SAAS;IACpB,KAAK,EAAM,UAAU;IACrB,GAAG,EAAQ,UAAU;IACrB,KAAK,EAAM,UAAU;IACrB,MAAM,EAAK,UAAU;IACrB,IAAI,EAAO,UAAU;IACrB,OAAO,EAAI,UAAU;IACrB,IAAI,EAAO,UAAU;IACrB,KAAK,EAAM,UAAU;IACrB,OAAO,EAAI,UAAU;IACrB,KAAK,EAAM,UAAU;IACrB,OAAO,EAAI,UAAU;IACrB,QAAQ,EAAG,UAAU;IACrB,MAAM,EAAK,UAAU;IACrB,SAAS,EAAE,UAAU;IACrB,MAAM,EAAK,UAAU;IACrB,OAAO,EAAI,UAAU;CACxB,CAAC;AAEK,MAAM,SAAS,GAAG,CAAC,GAAW,EAAU,EAAE;IAC7C,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC5B,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnB,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC;IACD,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5C,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5C,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAE5C,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;AACvC,CAAC,CAAC;AAVW,QAAA,SAAS,aAUpB;AAEK,MAAM,WAAW,GAAG,CAAC,GAAW,EAAU,EAAE;IAC/C,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC5B,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnB,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC;IACD,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5C,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5C,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAE5C,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;AACvC,CAAC,CAAC;AAVW,QAAA,WAAW,eAUtB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface StatusConfig {
|
|
2
|
+
lightColor: string;
|
|
3
|
+
darkColor: string;
|
|
4
|
+
code: string;
|
|
5
|
+
}
|
|
6
|
+
export interface VividLogConfig {
|
|
7
|
+
autoGroup: boolean;
|
|
8
|
+
timeNotation: string;
|
|
9
|
+
iUseLightTheme: boolean;
|
|
10
|
+
customStyle: string;
|
|
11
|
+
fontSize: string;
|
|
12
|
+
newLine: boolean;
|
|
13
|
+
status: {
|
|
14
|
+
[key: string]: StatusConfig;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
declare const config: VividLogConfig;
|
|
18
|
+
export default config;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config = {
|
|
4
|
+
autoGroup: true,
|
|
5
|
+
timeNotation: "h:m:s",
|
|
6
|
+
iUseLightTheme: false,
|
|
7
|
+
customStyle: "",
|
|
8
|
+
fontSize: "12px",
|
|
9
|
+
newLine: typeof navigator !== "undefined" ? navigator.userAgent.includes("Firefox") : false,
|
|
10
|
+
status: {
|
|
11
|
+
error: {
|
|
12
|
+
lightColor: "#da3030",
|
|
13
|
+
darkColor: "#872323",
|
|
14
|
+
code: "ERROR",
|
|
15
|
+
},
|
|
16
|
+
success: {
|
|
17
|
+
lightColor: "#00b808",
|
|
18
|
+
darkColor: "#21872a",
|
|
19
|
+
code: "SUCCESS",
|
|
20
|
+
},
|
|
21
|
+
warning: {
|
|
22
|
+
lightColor: "#da993e",
|
|
23
|
+
darkColor: "#875a2a",
|
|
24
|
+
code: "WARNING",
|
|
25
|
+
},
|
|
26
|
+
info: {
|
|
27
|
+
lightColor: "#b0b52c",
|
|
28
|
+
darkColor: "#788738",
|
|
29
|
+
code: "INFO",
|
|
30
|
+
},
|
|
31
|
+
debug: {
|
|
32
|
+
lightColor: "#da43be",
|
|
33
|
+
darkColor: "#872773",
|
|
34
|
+
code: "DEBUG",
|
|
35
|
+
},
|
|
36
|
+
log: {
|
|
37
|
+
lightColor: "#65b0b9",
|
|
38
|
+
darkColor: "#4f7e87",
|
|
39
|
+
code: "LOG",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
exports.default = config;
|
|
44
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../lib/config/config.ts"],"names":[],"mappings":";;AA0BA,MAAM,MAAM,GAAmB;IAC3B,SAAS,EAAO,IAAI;IACpB,YAAY,EAAI,OAAO;IACvB,cAAc,EAAE,KAAK;IACrB,WAAW,EAAK,EAAE;IAClB,QAAQ,EAAQ,MAAM;IACtB,OAAO,EAAS,OAAO,SAAS,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK;IAClG,MAAM,EAAU;QACZ,KAAK,EAAI;YACL,UAAU,EAAE,SAAS;YACrB,SAAS,EAAG,SAAS;YACrB,IAAI,EAAQ,OAAO;SACtB;QACD,OAAO,EAAE;YACL,UAAU,EAAE,SAAS;YACrB,SAAS,EAAG,SAAS;YACrB,IAAI,EAAQ,SAAS;SACxB;QACD,OAAO,EAAE;YACL,UAAU,EAAE,SAAS;YACrB,SAAS,EAAG,SAAS;YACrB,IAAI,EAAQ,SAAS;SACxB;QACD,IAAI,EAAK;YACL,UAAU,EAAE,SAAS;YACrB,SAAS,EAAG,SAAS;YACrB,IAAI,EAAQ,MAAM;SACrB;QACD,KAAK,EAAI;YACL,UAAU,EAAE,SAAS;YACrB,SAAS,EAAG,SAAS;YACrB,IAAI,EAAQ,OAAO;SACtB;QACD,GAAG,EAAM;YACL,UAAU,EAAE,SAAS;YACrB,SAAS,EAAG,SAAS;YACrB,IAAI,EAAQ,KAAK;SACpB;KACJ;CACJ,CAAC;AAEF,kBAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare enum LogSize {
|
|
2
|
+
SMALL_LOGGABLE = 0,
|
|
3
|
+
BIG_LOGGABLE = 1
|
|
4
|
+
}
|
|
5
|
+
export interface LogTypeInfo {
|
|
6
|
+
i: number;
|
|
7
|
+
val: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const DEBUG: LogTypeInfo;
|
|
10
|
+
export declare const ERROR: LogTypeInfo;
|
|
11
|
+
export declare const INFO: LogTypeInfo;
|
|
12
|
+
export declare const LOG: LogTypeInfo;
|
|
13
|
+
export declare const WARNING: LogTypeInfo;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WARNING = exports.LOG = exports.INFO = exports.ERROR = exports.DEBUG = exports.LogSize = void 0;
|
|
4
|
+
var LogSize;
|
|
5
|
+
(function (LogSize) {
|
|
6
|
+
LogSize[LogSize["SMALL_LOGGABLE"] = 0] = "SMALL_LOGGABLE";
|
|
7
|
+
LogSize[LogSize["BIG_LOGGABLE"] = 1] = "BIG_LOGGABLE";
|
|
8
|
+
})(LogSize || (exports.LogSize = LogSize = {}));
|
|
9
|
+
exports.DEBUG = {
|
|
10
|
+
i: 2,
|
|
11
|
+
val: "debug",
|
|
12
|
+
};
|
|
13
|
+
exports.ERROR = {
|
|
14
|
+
i: 3,
|
|
15
|
+
val: "error",
|
|
16
|
+
};
|
|
17
|
+
exports.INFO = {
|
|
18
|
+
i: 4,
|
|
19
|
+
val: "info",
|
|
20
|
+
};
|
|
21
|
+
exports.LOG = {
|
|
22
|
+
i: 5,
|
|
23
|
+
val: "log",
|
|
24
|
+
};
|
|
25
|
+
exports.WARNING = {
|
|
26
|
+
i: 6,
|
|
27
|
+
val: "warning",
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=enums.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../lib/enums.ts"],"names":[],"mappings":";;;AAAA,IAAY,OAGX;AAHD,WAAY,OAAO;IACf,yDAAkB,CAAA;IAClB,qDAAkB,CAAA;AACtB,CAAC,EAHW,OAAO,uBAAP,OAAO,QAGlB;AAQY,QAAA,KAAK,GAAgB;IAC9B,CAAC,EAAI,CAAC;IACN,GAAG,EAAE,OAAO;CACf,CAAC;AAEW,QAAA,KAAK,GAAgB;IAC9B,CAAC,EAAI,CAAC;IACN,GAAG,EAAE,OAAO;CACf,CAAC;AAEW,QAAA,IAAI,GAAgB;IAC7B,CAAC,EAAI,CAAC;IACN,GAAG,EAAE,MAAM;CACd,CAAC;AAEW,QAAA,GAAG,GAAgB;IAC5B,CAAC,EAAI,CAAC;IACN,GAAG,EAAE,KAAK;CACb,CAAC;AAEW,QAAA,OAAO,GAAgB;IAChC,CAAC,EAAI,CAAC;IACN,GAAG,EAAE,SAAS;CACjB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Methods = void 0;
|
|
4
|
+
class Methods {
|
|
5
|
+
static takeOver(turnOn) {
|
|
6
|
+
if (turnOn) {
|
|
7
|
+
if (typeof window !== "undefined") {
|
|
8
|
+
window.onerror = (_message, _source, _lineno, _colno, error) => {
|
|
9
|
+
if (error) {
|
|
10
|
+
window.vividLog?.err(error.stack);
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
return false;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
else if (typeof process !== "undefined") {
|
|
17
|
+
process.on("uncaughtException", (error) => {
|
|
18
|
+
const vividLog = global.vividLog;
|
|
19
|
+
if (vividLog) {
|
|
20
|
+
vividLog.err(error.stack);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
console.error(error);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
const vividLog = (typeof window !== "undefined") ? window.vividLog : global.vividLog;
|
|
30
|
+
vividLog?.style("font-style: italic;").say("f v.takeOver() was called but was not turned on. Do so by using v.takeOver(true)", "VividLog", "#E3342F");
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.Methods = Methods;
|
|
35
|
+
//# sourceMappingURL=methods.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods.js","sourceRoot":"","sources":["../../lib/methods.ts"],"names":[],"mappings":";;;AAAA,MAAa,OAAO;IAChB,MAAM,CAAC,QAAQ,CAAC,MAAe;QAC3B,IAAI,MAAM,EAAE,CAAC;YACT,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;gBAChC,MAAM,CAAC,OAAO,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;oBAC3D,IAAI,KAAK,EAAE,CAAC;wBACR,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;wBAClC,OAAO,IAAI,CAAC;oBAChB,CAAC;oBAED,OAAO,KAAK,CAAC;gBACjB,CAAC,CAAC;YACN,CAAC;iBAAM,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE,CAAC;gBACxC,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE;oBACtC,MAAM,QAAQ,GAAI,MAAc,CAAC,QAAQ,CAAC;oBAC1C,IAAI,QAAQ,EAAE,CAAC;wBACX,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;oBAC9B,CAAC;yBAAM,CAAC;wBACJ,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;oBACzB,CAAC;gBACL,CAAC,CAAC,CAAC;YACP,CAAC;YACD,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,QAAQ,GAAG,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAE,MAAc,CAAC,QAAQ,CAAC;QAE9F,QAAQ,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAC,GAAG,CAAC,kFAAkF,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;QAEtJ,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AA/BD,0BA+BC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { LogSize } from "./enums";
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
vividLog: any;
|
|
5
|
+
}
|
|
6
|
+
const vividLog: any;
|
|
7
|
+
}
|
|
8
|
+
export declare class Utils {
|
|
9
|
+
static evaluate(loggable: any, type: string): boolean;
|
|
10
|
+
static getType(loggable: any): string | false;
|
|
11
|
+
static isTypeOfLoggable(variable: string): boolean;
|
|
12
|
+
static createTime(format: string): string | false;
|
|
13
|
+
static timeObj(format: string): {
|
|
14
|
+
format: string[];
|
|
15
|
+
h: string;
|
|
16
|
+
m: string;
|
|
17
|
+
s: string;
|
|
18
|
+
ms: string;
|
|
19
|
+
};
|
|
20
|
+
static checkTypeLog(loggable: any): LogSize;
|
|
21
|
+
static makeStyleCompatible(css: string): string;
|
|
22
|
+
static styleBuilder(type: string, color?: string): {
|
|
23
|
+
status: string;
|
|
24
|
+
time: string;
|
|
25
|
+
type: string;
|
|
26
|
+
var: string;
|
|
27
|
+
};
|
|
28
|
+
static logBuilder(loggable: any, typeOrLabel: string, onlyHeader?: boolean): string;
|
|
29
|
+
static resetConfs(): boolean;
|
|
30
|
+
static fire(loggable: string, style: any): boolean;
|
|
31
|
+
static fireLabel(label: string, type?: string): void;
|
|
32
|
+
static loggable(args: IArguments | any[], type: string): boolean;
|
|
33
|
+
static iterateLoggables(args: IArguments | any[], type: string): boolean;
|
|
34
|
+
}
|