1616
1717import { Table } from "@google-cloud/bigquery" ;
1818import { firestore } from "firebase-admin" ;
19- import { logger } from "firebase-functions " ;
19+ import { logger } from "./logger " ;
2020
2121export const arrayFieldInvalid = ( fieldName : string ) => {
2222 logger . warn ( `Array field '${ fieldName } ' does not contain an array, skipping` ) ;
2323} ;
2424
2525export const bigQueryDatasetCreated = ( datasetId : string ) => {
26- logger . log ( `Created BigQuery dataset: ${ datasetId } ` ) ;
26+ logger . info ( `Created BigQuery dataset: ${ datasetId } ` ) ;
2727} ;
2828
2929export const bigQueryDatasetCreating = ( datasetId : string ) => {
30- logger . log ( `Creating BigQuery dataset: ${ datasetId } ` ) ;
30+ logger . debug ( `Creating BigQuery dataset: ${ datasetId } ` ) ;
3131} ;
3232
3333export const bigQueryDatasetExists = ( datasetId : string ) => {
34- logger . log ( `BigQuery dataset already exists: ${ datasetId } ` ) ;
34+ logger . info ( `BigQuery dataset already exists: ${ datasetId } ` ) ;
3535} ;
3636
3737export const bigQueryErrorRecordingDocumentChange = ( e : Error ) => {
3838 logger . error ( `Error recording document changes.` , e ) ;
3939} ;
4040
4141export const bigQueryLatestSnapshotViewQueryCreated = ( query : string ) => {
42- logger . log ( `BigQuery latest snapshot view query:\n${ query } ` ) ;
42+ logger . debug ( `BigQuery latest snapshot view query:\n${ query } ` ) ;
4343} ;
4444
4545export const bigQuerySchemaViewCreated = ( name : string ) => {
46- logger . log ( `BigQuery created schema view ${ name } \n` ) ;
46+ logger . debug ( `BigQuery created schema view ${ name } \n` ) ;
4747} ;
4848
4949export const bigQueryTableAlreadyExists = (
5050 tableName : string ,
5151 datasetName : string
5252) => {
53- logger . log (
53+ logger . debug (
5454 `BigQuery table with name ${ tableName } already ` +
5555 `exists in dataset ${ datasetName } !`
5656 ) ;
5757} ;
5858
5959export const bigQueryTableCreated = ( tableName : string ) => {
60- logger . log ( `Created BigQuery table: ${ tableName } ` ) ;
60+ logger . info ( `Created BigQuery table: ${ tableName } ` ) ;
6161} ;
6262
6363export const bigQueryTableCreating = ( tableName : string ) => {
64- logger . log ( `Creating BigQuery table: ${ tableName } ` ) ;
64+ logger . debug ( `Creating BigQuery table: ${ tableName } ` ) ;
6565} ;
6666
6767export const bigQueryTableUpdated = ( tableName : string ) => {
68- logger . log ( `Updated existing BigQuery table: ${ tableName } ` ) ;
68+ logger . info ( `Updated existing BigQuery table: ${ tableName } ` ) ;
6969} ;
7070
7171export const bigQueryTableUpdating = ( tableName : string ) => {
72- logger . log ( `Updating existing BigQuery table: ${ tableName } ` ) ;
72+ logger . debug ( `Updating existing BigQuery table: ${ tableName } ` ) ;
7373} ;
7474
7575export const bigQueryTableUpToDate = ( tableName : string ) => {
76- logger . log ( `BigQuery table: ${ tableName } is up to date` ) ;
76+ logger . info ( `BigQuery table: ${ tableName } is up to date` ) ;
7777} ;
7878
7979export const bigQueryTableValidated = ( tableName : string ) => {
80- logger . log ( `Validated existing BigQuery table: ${ tableName } ` ) ;
80+ logger . info ( `Validated existing BigQuery table: ${ tableName } ` ) ;
8181} ;
8282
8383export const bigQueryTableValidating = ( tableName : string ) => {
84- logger . log ( `Validating existing BigQuery table: ${ tableName } ` ) ;
84+ logger . debug ( `Validating existing BigQuery table: ${ tableName } ` ) ;
8585} ;
8686
8787export const bigQueryUserDefinedFunctionCreating = ( functionName : string ) => {
88- logger . log ( `Creating BigQuery user-defined function ${ functionName } ` ) ;
88+ logger . debug ( `Creating BigQuery user-defined function ${ functionName } ` ) ;
8989} ;
9090
9191export const bigQueryUserDefinedFunctionCreated = ( functionName : string ) => {
92- logger . log ( `Created BigQuery user-defined function ${ functionName } ` ) ;
92+ logger . info ( `Created BigQuery user-defined function ${ functionName } ` ) ;
9393} ;
9494
9595export const bigQueryViewCreated = ( viewName : string ) => {
96- logger . log ( `Created BigQuery view: ${ viewName } ` ) ;
96+ logger . info ( `Created BigQuery view: ${ viewName } ` ) ;
9797} ;
9898
9999export 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 } ` ) ;
101101} ;
102102
103103export const bigQueryViewAlreadyExists = (
104104 viewName : string ,
105105 datasetName : string
106106) => {
107- logger . log (
107+ logger . info (
108108 `View with id ${ viewName } already exists in dataset ${ datasetName } .`
109109 ) ;
110110} ;
111111
112112export const bigQueryViewUpdated = ( viewName : string ) => {
113- logger . log ( `Updated existing BigQuery view: ${ viewName } ` ) ;
113+ logger . info ( `Updated existing BigQuery view: ${ viewName } ` ) ;
114114} ;
115115
116116export const bigQueryViewUpdating = ( viewName : string ) => {
117- logger . log ( `Updating existing BigQuery view: ${ viewName } ` ) ;
117+ logger . debug ( `Updating existing BigQuery view: ${ viewName } ` ) ;
118118} ;
119119
120120export const bigQueryViewUpToDate = ( viewName : string ) => {
121- logger . log ( `BigQuery view: ${ viewName } is up to date` ) ;
121+ logger . info ( `BigQuery view: ${ viewName } is up to date` ) ;
122122} ;
123123
124124export const bigQueryViewValidated = ( viewName : string ) => {
125- logger . log ( `Validated existing BigQuery view: ${ viewName } ` ) ;
125+ logger . info ( `Validated existing BigQuery view: ${ viewName } ` ) ;
126126} ;
127127
128128export const bigQueryViewValidating = ( viewName : string ) => {
129- logger . log ( `Validating existing BigQuery view: ${ viewName } ` ) ;
129+ logger . debug ( `Validating existing BigQuery view: ${ viewName } ` ) ;
130130} ;
131131
132132export const complete = ( ) => {
133- logger . log ( "Completed mod execution" ) ;
133+ logger . info ( "Completed mod execution" ) ;
134134} ;
135135
136136export 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` ) ;
138138} ;
139139
140140export const dataInsertRetried = ( rowCount : number ) => {
141- logger . log (
141+ logger . debug (
142142 `Retried to insert ${ rowCount } row(s) of data into BigQuery (ignoring unknown columns)`
143143 ) ;
144144} ;
145145
146146export 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` ) ;
148148} ;
149149
150150export const dataTypeInvalid = (
@@ -168,11 +168,11 @@ export const timestampMissingValue = (fieldName: string) => {
168168} ;
169169
170170export 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` ) ;
172172} ;
173173
174174export const addPartitionFieldColumn = ( table , field ) => {
175- logger . log (
175+ logger . info (
176176 `Updated '${ table } ' table with a partition field '${ field } ' column`
177177 ) ;
178178} ;
0 commit comments