16
16
17
17
import { Table } from "@google-cloud/bigquery" ;
18
18
import { firestore } from "firebase-admin" ;
19
- import { logger } from "firebase-functions " ;
19
+ import { logger } from "./logger " ;
20
20
21
21
export const arrayFieldInvalid = ( fieldName : string ) => {
22
22
logger . warn ( `Array field '${ fieldName } ' does not contain an array, skipping` ) ;
23
23
} ;
24
24
25
25
export const bigQueryDatasetCreated = ( datasetId : string ) => {
26
- logger . log ( `Created BigQuery dataset: ${ datasetId } ` ) ;
26
+ logger . info ( `Created BigQuery dataset: ${ datasetId } ` ) ;
27
27
} ;
28
28
29
29
export const bigQueryDatasetCreating = ( datasetId : string ) => {
30
- logger . log ( `Creating BigQuery dataset: ${ datasetId } ` ) ;
30
+ logger . debug ( `Creating BigQuery dataset: ${ datasetId } ` ) ;
31
31
} ;
32
32
33
33
export const bigQueryDatasetExists = ( datasetId : string ) => {
34
- logger . log ( `BigQuery dataset already exists: ${ datasetId } ` ) ;
34
+ logger . info ( `BigQuery dataset already exists: ${ datasetId } ` ) ;
35
35
} ;
36
36
37
37
export const bigQueryErrorRecordingDocumentChange = ( e : Error ) => {
38
38
logger . error ( `Error recording document changes.` , e ) ;
39
39
} ;
40
40
41
41
export const bigQueryLatestSnapshotViewQueryCreated = ( query : string ) => {
42
- logger . log ( `BigQuery latest snapshot view query:\n${ query } ` ) ;
42
+ logger . debug ( `BigQuery latest snapshot view query:\n${ query } ` ) ;
43
43
} ;
44
44
45
45
export const bigQuerySchemaViewCreated = ( name : string ) => {
46
- logger . log ( `BigQuery created schema view ${ name } \n` ) ;
46
+ logger . debug ( `BigQuery created schema view ${ name } \n` ) ;
47
47
} ;
48
48
49
49
export const bigQueryTableAlreadyExists = (
50
50
tableName : string ,
51
51
datasetName : string
52
52
) => {
53
- logger . log (
53
+ logger . debug (
54
54
`BigQuery table with name ${ tableName } already ` +
55
55
`exists in dataset ${ datasetName } !`
56
56
) ;
57
57
} ;
58
58
59
59
export const bigQueryTableCreated = ( tableName : string ) => {
60
- logger . log ( `Created BigQuery table: ${ tableName } ` ) ;
60
+ logger . info ( `Created BigQuery table: ${ tableName } ` ) ;
61
61
} ;
62
62
63
63
export const bigQueryTableCreating = ( tableName : string ) => {
64
- logger . log ( `Creating BigQuery table: ${ tableName } ` ) ;
64
+ logger . debug ( `Creating BigQuery table: ${ tableName } ` ) ;
65
65
} ;
66
66
67
67
export const bigQueryTableUpdated = ( tableName : string ) => {
68
- logger . log ( `Updated existing BigQuery table: ${ tableName } ` ) ;
68
+ logger . info ( `Updated existing BigQuery table: ${ tableName } ` ) ;
69
69
} ;
70
70
71
71
export const bigQueryTableUpdating = ( tableName : string ) => {
72
- logger . log ( `Updating existing BigQuery table: ${ tableName } ` ) ;
72
+ logger . debug ( `Updating existing BigQuery table: ${ tableName } ` ) ;
73
73
} ;
74
74
75
75
export const bigQueryTableUpToDate = ( tableName : string ) => {
76
- logger . log ( `BigQuery table: ${ tableName } is up to date` ) ;
76
+ logger . info ( `BigQuery table: ${ tableName } is up to date` ) ;
77
77
} ;
78
78
79
79
export const bigQueryTableValidated = ( tableName : string ) => {
80
- logger . log ( `Validated existing BigQuery table: ${ tableName } ` ) ;
80
+ logger . info ( `Validated existing BigQuery table: ${ tableName } ` ) ;
81
81
} ;
82
82
83
83
export const bigQueryTableValidating = ( tableName : string ) => {
84
- logger . log ( `Validating existing BigQuery table: ${ tableName } ` ) ;
84
+ logger . debug ( `Validating existing BigQuery table: ${ tableName } ` ) ;
85
85
} ;
86
86
87
87
export const bigQueryUserDefinedFunctionCreating = ( functionName : string ) => {
88
- logger . log ( `Creating BigQuery user-defined function ${ functionName } ` ) ;
88
+ logger . debug ( `Creating BigQuery user-defined function ${ functionName } ` ) ;
89
89
} ;
90
90
91
91
export const bigQueryUserDefinedFunctionCreated = ( functionName : string ) => {
92
- logger . log ( `Created BigQuery user-defined function ${ functionName } ` ) ;
92
+ logger . info ( `Created BigQuery user-defined function ${ functionName } ` ) ;
93
93
} ;
94
94
95
95
export const bigQueryViewCreated = ( viewName : string ) => {
96
- logger . log ( `Created BigQuery view: ${ viewName } ` ) ;
96
+ logger . info ( `Created BigQuery view: ${ viewName } ` ) ;
97
97
} ;
98
98
99
99
export const bigQueryViewCreating = ( viewName : string , query : string ) => {
100
- logger . log ( `Creating BigQuery view: ${ viewName } \nQuery:\n${ query } ` ) ;
100
+ logger . debug ( `Creating BigQuery view: ${ viewName } \nQuery:\n${ query } ` ) ;
101
101
} ;
102
102
103
103
export const bigQueryViewAlreadyExists = (
104
104
viewName : string ,
105
105
datasetName : string
106
106
) => {
107
- logger . log (
107
+ logger . info (
108
108
`View with id ${ viewName } already exists in dataset ${ datasetName } .`
109
109
) ;
110
110
} ;
111
111
112
112
export const bigQueryViewUpdated = ( viewName : string ) => {
113
- logger . log ( `Updated existing BigQuery view: ${ viewName } ` ) ;
113
+ logger . info ( `Updated existing BigQuery view: ${ viewName } ` ) ;
114
114
} ;
115
115
116
116
export const bigQueryViewUpdating = ( viewName : string ) => {
117
- logger . log ( `Updating existing BigQuery view: ${ viewName } ` ) ;
117
+ logger . debug ( `Updating existing BigQuery view: ${ viewName } ` ) ;
118
118
} ;
119
119
120
120
export const bigQueryViewUpToDate = ( viewName : string ) => {
121
- logger . log ( `BigQuery view: ${ viewName } is up to date` ) ;
121
+ logger . info ( `BigQuery view: ${ viewName } is up to date` ) ;
122
122
} ;
123
123
124
124
export const bigQueryViewValidated = ( viewName : string ) => {
125
- logger . log ( `Validated existing BigQuery view: ${ viewName } ` ) ;
125
+ logger . info ( `Validated existing BigQuery view: ${ viewName } ` ) ;
126
126
} ;
127
127
128
128
export const bigQueryViewValidating = ( viewName : string ) => {
129
- logger . log ( `Validating existing BigQuery view: ${ viewName } ` ) ;
129
+ logger . debug ( `Validating existing BigQuery view: ${ viewName } ` ) ;
130
130
} ;
131
131
132
132
export const complete = ( ) => {
133
- logger . log ( "Completed mod execution" ) ;
133
+ logger . info ( "Completed mod execution" ) ;
134
134
} ;
135
135
136
136
export const dataInserted = ( rowCount : number ) => {
137
- logger . log ( `Inserted ${ rowCount } row(s) of data into BigQuery` ) ;
137
+ logger . debug ( `Inserted ${ rowCount } row(s) of data into BigQuery` ) ;
138
138
} ;
139
139
140
140
export const dataInsertRetried = ( rowCount : number ) => {
141
- logger . log (
141
+ logger . debug (
142
142
`Retried to insert ${ rowCount } row(s) of data into BigQuery (ignoring unknown columns)`
143
143
) ;
144
144
} ;
145
145
146
146
export const dataInserting = ( rowCount : number ) => {
147
- logger . log ( `Inserting ${ rowCount } row(s) of data into BigQuery` ) ;
147
+ logger . debug ( `Inserting ${ rowCount } row(s) of data into BigQuery` ) ;
148
148
} ;
149
149
150
150
export const dataTypeInvalid = (
@@ -168,11 +168,11 @@ export const timestampMissingValue = (fieldName: string) => {
168
168
} ;
169
169
170
170
export const addNewColumn = ( table : string , field : string ) => {
171
- logger . log ( `Updated '${ table } ' table with a '${ field } ' column` ) ;
171
+ logger . info ( `Updated '${ table } ' table with a '${ field } ' column` ) ;
172
172
} ;
173
173
174
174
export const addPartitionFieldColumn = ( table , field ) => {
175
- logger . log (
175
+ logger . info (
176
176
`Updated '${ table } ' table with a partition field '${ field } ' column`
177
177
) ;
178
178
} ;
0 commit comments