@innei/pretty-logger-core 0.3.3 → 0.3.5
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/consola/consola.ts +15 -15
- package/consola/constants.ts +0 -1
- package/consola/index.ts +3 -3
- package/consola/reporters/basic.ts +2 -2
- package/consola/reporters/browser.ts +1 -0
- package/consola/reporters/fancy.ts +8 -8
- package/consola/reporters/file.ts +7 -6
- package/consola/reporters/logger.ts +4 -4
- package/consola/reporters/subscriber.ts +4 -5
- package/consola/shared.ts +3 -4
- package/consola/utils/string.ts +6 -1
- package/consola/utils.ts +3 -3
- package/consola.instance.ts +3 -3
- package/dist/index.d.mts +153 -137
- package/dist/index.d.ts +153 -137
- package/dist/index.js +821 -1064
- package/dist/index.mjs +817 -1022
- package/index.ts +1 -1
- package/package.json +10 -10
- package/tool.util.ts +7 -16
- package/{tsup.config.ts → tsdown.config.ts} +1 -1
package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@innei/pretty-logger-core",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"main": "dist/index.js",
|
|
5
|
-
"module": "dist/index.mjs",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
3
|
+
"version": "0.3.5",
|
|
7
4
|
"exports": {
|
|
8
5
|
".": {
|
|
9
6
|
"require": "./dist/index.js",
|
|
10
7
|
"import": "./dist/index.mjs"
|
|
11
8
|
}
|
|
12
9
|
},
|
|
10
|
+
"main": "dist/index.js",
|
|
11
|
+
"module": "dist/index.mjs",
|
|
12
|
+
"types": "dist/index.d.ts",
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsdown"
|
|
15
|
+
},
|
|
13
16
|
"dependencies": {
|
|
14
|
-
"cron": "3.
|
|
17
|
+
"cron": "4.3.0",
|
|
15
18
|
"defu": "^6.1.3",
|
|
16
19
|
"picocolors": "^1.0.0",
|
|
17
20
|
"std-env": "^3.5.0"
|
|
18
21
|
},
|
|
19
22
|
"devDependencies": {
|
|
20
|
-
"string-width": "
|
|
21
|
-
},
|
|
22
|
-
"scripts": {
|
|
23
|
-
"build": "tsup"
|
|
23
|
+
"string-width": "7.2.0"
|
|
24
24
|
}
|
|
25
|
-
}
|
|
25
|
+
}
|
package/tool.util.ts
CHANGED
|
@@ -1,29 +1,20 @@
|
|
|
1
|
-
import path from 'path'
|
|
1
|
+
import path from 'node:path'
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export function getShortTime (date: Date) {
|
|
4
4
|
return Intl.DateTimeFormat('en-US', {
|
|
5
5
|
timeStyle: 'medium',
|
|
6
6
|
hour12: false,
|
|
7
7
|
}).format(date)
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export
|
|
10
|
+
export function getShortDate (date: Date) {
|
|
11
11
|
return Intl.DateTimeFormat('en-US', {
|
|
12
12
|
dateStyle: 'short',
|
|
13
13
|
})
|
|
14
14
|
.format(date)
|
|
15
|
-
.
|
|
16
|
-
}
|
|
17
|
-
/** 2-12-22, 21:31:42 */
|
|
18
|
-
export const getShortDateTime = (date: Date) => {
|
|
19
|
-
return Intl.DateTimeFormat('en-US', {
|
|
20
|
-
dateStyle: 'short',
|
|
21
|
-
timeStyle: 'medium',
|
|
22
|
-
hour12: false,
|
|
23
|
-
})
|
|
24
|
-
.format(date)
|
|
25
|
-
.replace(/\//g, '-')
|
|
15
|
+
.replaceAll('/', '-')
|
|
26
16
|
}
|
|
27
17
|
|
|
28
|
-
export
|
|
29
|
-
path.resolve(logDir, formatString.
|
|
18
|
+
export function getLogFilePath (logDir: string, formatString: string) {
|
|
19
|
+
return path.resolve(logDir, formatString.replaceAll('%d', getShortDate(new Date())))
|
|
20
|
+
}
|