File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed
lib/javascript/fullstack_demo Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -25,5 +25,5 @@ model Logs {
25
25
level String @db.VarChar
26
26
message String @default (" " ) @db.VarChar
27
27
timestamp DateTime @db.Timestamp (6 )
28
- meta Json ? @db.Json
28
+ meta Json ?
29
29
}
Original file line number Diff line number Diff line change @@ -8,19 +8,23 @@ export class PrismaTransport extends Transport {
8
8
super ( opts ) ;
9
9
}
10
10
11
- log ( info : any , callback : ( ) => void ) : void {
11
+ async log ( info : any , callback : ( ) => void ) : Promise < void > {
12
12
setImmediate ( ( ) => {
13
13
this . emit ( 'logged' , info ) ;
14
14
} ) ;
15
15
16
- this . client . logs . create ( {
17
- data : {
18
- level : info . level ,
19
- message : info . message ,
20
- meta : info . vars ,
21
- timestamp : info . timestamp ,
22
- } ,
23
- } ) ;
16
+ try {
17
+ await this . client . logs . create ( {
18
+ data : {
19
+ level : info . level ,
20
+ message : info . message ,
21
+ meta : info ,
22
+ timestamp : info . timestamp ,
23
+ } ,
24
+ } ) ;
25
+ } catch ( ex ) {
26
+ console . error ( 'Failed to log to Prisma' , ex ) ;
27
+ }
24
28
25
29
callback ( ) ;
26
30
}
You can’t perform that action at this time.
0 commit comments