@stacksjs/logging 0.58.47 → 0.58.49
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 +5 -4
- package/src/index.ts +27 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/logging",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.58.
|
|
4
|
+
"version": "0.58.49",
|
|
5
5
|
"description": "The Stacks logging system.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"license": "MIT",
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
],
|
|
40
40
|
"files": [
|
|
41
41
|
"README.md",
|
|
42
|
-
"dist"
|
|
42
|
+
"dist",
|
|
43
|
+
"src"
|
|
43
44
|
],
|
|
44
45
|
"scripts": {
|
|
45
46
|
"build": "bun --bun build.ts",
|
|
@@ -47,8 +48,8 @@
|
|
|
47
48
|
"prepublishOnly": "bun --bun run build"
|
|
48
49
|
},
|
|
49
50
|
"peerDependencies": {
|
|
50
|
-
"@stacksjs/cli": "
|
|
51
|
-
"@stacksjs/error-handling": "
|
|
51
|
+
"@stacksjs/cli": "latest",
|
|
52
|
+
"@stacksjs/error-handling": "latest"
|
|
52
53
|
},
|
|
53
54
|
"dependencies": {
|
|
54
55
|
"@stacksjs/cli": "latest",
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import process from 'node:process'
|
|
2
|
+
import consola from 'consola'
|
|
3
|
+
import { ExitCode } from '@stacksjs/types'
|
|
4
|
+
|
|
5
|
+
export const logger = consola
|
|
6
|
+
export const log = consola
|
|
7
|
+
// export const log = {
|
|
8
|
+
// info: (...args: any[]) => consola.info(...args),
|
|
9
|
+
// success: (msg: string) => logger.success(msg),
|
|
10
|
+
// error: (err: string | StacksError, options?: any) => handleError(err, options),
|
|
11
|
+
// warn: (...args: any[]) => logger.warn(...args),
|
|
12
|
+
// debug: (...args: any[]) => logger.debug(...args),
|
|
13
|
+
// prompt:
|
|
14
|
+
// dump,
|
|
15
|
+
// dd,
|
|
16
|
+
// }
|
|
17
|
+
|
|
18
|
+
export function dump(...args: any[]) {
|
|
19
|
+
return log.debug(args)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function dd(...args: any[]) {
|
|
23
|
+
args.forEach(arg => log.debug(arg))
|
|
24
|
+
// we need to return a non-zero exit code to indicate an error
|
|
25
|
+
// e.g. if used in a CDK script, we want it to fail the deployment
|
|
26
|
+
process.exit(ExitCode.FatalError)
|
|
27
|
+
}
|