File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " @privyid/pong" ,
3- "version" : " 0.8 .0" ,
3+ "version" : " 0.9 .0" ,
44 "packageManager" : " yarn@4.7.0" ,
55 "description" : " Service discovery, Log & Trace module" ,
66 "repository" : {
4646 "dd-trace" : " ^5.23.0" ,
4747 "defu" : " ^6.1.2" ,
4848 "destr" : " ^2.0.1" ,
49- "fast-content-type-parse" : " ^2 .0.0" ,
49+ "fast-content-type-parse" : " ^3 .0.0" ,
5050 "magic-string" : " ^0.30.11" ,
5151 "pino-http" : " ^10.0.0" ,
5252 "systeminformation" : " ^5.23.5" ,
Original file line number Diff line number Diff line change @@ -11,6 +11,13 @@ import { isUUID } from './utils'
1111
1212let logger : HttpLogger < IncomingMessage , ServerResponse , 'error' | 'warn' | 'silent' | 'info' >
1313
14+ enum LOG_LEVEL {
15+ 'silent' = 0 ,
16+ 'info' = 1 ,
17+ 'warn' = 2 ,
18+ 'error' = 3 ,
19+ }
20+
1421export function useLogger ( ) {
1522 if ( ! logger ) {
1623 const config = useRuntimeConfig ( )
@@ -33,18 +40,20 @@ export function useLogger () {
3340 return reqId && isUUID ( reqId ) ? reqId : uuidv4 ( )
3441 } ,
3542 customLogLevel ( req , res , err ) {
36- const { logLevelThreshold } = config . pong
43+ const threshold = LOG_LEVEL [ config . pong . logLevelThreshold as 'error' | 'warn' | 'info' ] ?? 1
44+
45+ let level = LOG_LEVEL . info
3746
3847 if ( res . statusCode >= 500 || err )
39- return ' error'
40- else if ( res . statusCode >= 400 && res . statusCode < 500 ) {
41- if ( logLevelThreshold === 'error' )
42- return 'silent'
43- return 'warn'
44- } else if ( res . statusCode >= 300 && res . statusCode < 400 )
45- return 'silent'
46-
47- return logLevelThreshold === 'error' || logLevelThreshold === 'warn' ? ' silent' : 'info'
48+ level = LOG_LEVEL . error
49+ else if ( res . statusCode >= 400 && res . statusCode < 500 )
50+ level = LOG_LEVEL . warn
51+ else if ( res . statusCode >= 300 && res . statusCode < 400 )
52+ level = LOG_LEVEL . silent
53+
54+ return ( level >= threshold
55+ ? LOG_LEVEL [ level ] as 'error' | 'warn' | 'silent' | 'info'
56+ : ' silent')
4857 } ,
4958 } )
5059
Original file line number Diff line number Diff line change 66 ref ,
77 watch ,
88 type Ref ,
9+ useCookie ,
910} from '#imports'
1011import { onRequest } from '@privyid/nuapi/core'
1112import { v4 as uuidv4 } from 'uuid'
@@ -33,7 +34,7 @@ export default defineNuxtPlugin({
3334 enforce : 'post' ,
3435 setup ( ) {
3536 const isLoading = ref ( false )
36- const browserId = ref ( )
37+ const browserId = useCookie ( '_browser/fingerprint' )
3738 const route = useRoute ( )
3839
3940 const appName = useState ( 'appName' , ( ) => env . APP_NAME )
@@ -46,12 +47,12 @@ export default defineNuxtPlugin({
4647 /**
4748 * Add Browser's fingerprint
4849 */
49- if ( ! config . headers [ 'X-Browser-Id' ] && import . meta . client ) {
50+ if ( ! config . headers [ 'X-Browser-Id' ] ) {
5051 // Prevent double request
5152 if ( isLoading . value )
5253 await waitLoading ( isLoading )
5354
54- if ( ! browserId . value ) {
55+ if ( ! browserId . value && import . meta . client ) {
5556 try {
5657 isLoading . value = true
5758
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ export default defineEventHandler(async () => {
2727 memory : formatAllBytes ( {
2828 process : memoryUsage ( ) ,
2929 os : await si . mem ( ) ,
30+ docker : await si . dockerContainerStats ( ) ,
3031 } ) ,
3132 }
3233 : undefined ,
Original file line number Diff line number Diff line change @@ -2419,7 +2419,7 @@ __metadata:
24192419 eslint-plugin-unicorn : " npm:47.0.0"
24202420 eslint-plugin-varspacing : " npm:1.2.2"
24212421 eslint-plugin-vue : " npm:9.33.0"
2422- fast-content-type-parse : " npm:^2 .0.0"
2422+ fast-content-type-parse : " npm:^3 .0.0"
24232423 magic-string : " npm:^0.30.11"
24242424 nuxt : " npm:3.16.0"
24252425 pino-http : " npm:^10.0.0"
@@ -6765,10 +6765,10 @@ __metadata:
67656765 languageName : node
67666766 linkType : hard
67676767
6768- " fast-content-type-parse@npm:^2 .0.0 " :
6769- version : 2 .0.0
6770- resolution : " fast-content-type-parse@npm:2 .0.0"
6771- checksum : 10/49d938804e3500fbcd0aad94441bb485b1e9d7e5e0576e4d98f701e4f93104c4809ae8200419078755b4a268ce5f4d4664803f956d9dbcb79359d16676bf348f
6768+ " fast-content-type-parse@npm:^3 .0.0 " :
6769+ version : 3 .0.0
6770+ resolution : " fast-content-type-parse@npm:3 .0.0"
6771+ checksum : 10/8616a8aa6c9b4f8f4f3c90eaa4e7bfc2240cfa6f41f0eef5b5aa2b2c8b38bd9ad435f1488b6d817ffd725c54651e2777b882ae9dd59366e71e7896f1ec11d473
67726772 languageName : node
67736773 linkType : hard
67746774
You can’t perform that action at this time.
0 commit comments