File tree Expand file tree Collapse file tree 3 files changed +62
-2
lines changed Expand file tree Collapse file tree 3 files changed +62
-2
lines changed Original file line number Diff line number Diff line change 1
1
/// <reference types="node" />
2
+ import { Transform } from 'stream' ;
3
+ import { LoggingOptions , Log , LogSync } from '@google-cloud/logging' ;
4
+
5
+ declare function CloudPine ( options ?: CloudPineOptions ) : Transform ;
6
+
7
+ type CloudPineOptions = {
8
+ logName ?: string ;
9
+ cloudLoggingOptions : {
10
+ googleCloudOptions ?: LoggingOptions ;
11
+ resourceSettings ?: {
12
+ type ?: string ;
13
+ labels : Record < string , string > ;
14
+ } ;
15
+ defaultLabels ?: Record < string , string > ;
16
+ skipInit ?: boolean ;
17
+ sync ?: boolean ;
18
+ logOptions ?: ConstructorParameters < typeof Log > | ConstructorParameters < typeof LogSync > ;
19
+ } ;
20
+ } ;
21
+
22
+ export default CloudPine ;
23
+ export { CloudPineOptions } ;
Original file line number Diff line number Diff line change @@ -52,8 +52,8 @@ class CloudLogging {
52
52
this . _resource . labels = labels
53
53
54
54
this . _log = this . _sync
55
- ? this . logging . logSync ( this . name )
56
- : this . logging . log ( this . name )
55
+ ? this . logging . logSync ( this . name , this . _logOptions )
56
+ : this . logging . log ( this . name , this . _logOptions )
57
57
58
58
return this . _log
59
59
}
Original file line number Diff line number Diff line change
1
+ import { Transform } from 'stream' ;
2
+ import { expectAssignable , expectType } from 'tsd' ;
3
+
4
+ import Pino from 'pino' ;
5
+
6
+ import CloudPine , { CloudPineOptions } from '../' ;
7
+
8
+
9
+ const options : CloudPineOptions = {
10
+ logName : 'something' ,
11
+ cloudLoggingOptions : {
12
+ googleCloudOptions : {
13
+ projectId : 'some-projectid' ,
14
+ } ,
15
+ skipInit : true ,
16
+ sync : false ,
17
+ } ,
18
+ } ;
19
+
20
+ expectType < typeof CloudPine > ( CloudPine ) ;
21
+ expectAssignable < CloudPineOptions > ( {
22
+ logName : 'something' ,
23
+ cloudLoggingOptions : {
24
+ googleCloudOptions : {
25
+ projectId : 'some-projectid' ,
26
+ } ,
27
+ skipInit : true ,
28
+ sync : false ,
29
+ } ,
30
+ } ) ;
31
+ expectType < Transform > ( CloudPine ( options ) ) ;
32
+
33
+ Pino ( {
34
+ transport : {
35
+ options,
36
+ target : 'cloud-pine' ,
37
+ }
38
+ } )
You can’t perform that action at this time.
0 commit comments