1.0.4 • Published 4 years ago
jotive-firebase-logger-module v1.0.4
Jotive Nestjs Firebase Logger Module
Nesjs module for logging to Firebase / Google Cloud stackdriver.
Usage
Needs the following environment variables:
- process.env.GOOGLE_APPLICATION_CREDENTIALS
1. Initialize firebase admin:
import * as admin from 'firebase-admin';
admin.initializeApp({
credential: admin.credential.applicationDefault(),
});
2. Initialize in app.module.ts for error logging:
import { LoggerModule } from '@jotive/jotive-firebase-logger-module';
//...
@Module({
imports: [
LoggerModule,
//...
],
//...
})
3. For custom messages use LoggerService
import in the module:
import { LoggerModule } from '@jotive/jotive-firebase-logger-module';
@Module({
imports: [LoggerModule],
// ...
})
and use the LoggerService for logging
import { LoggerService } from '@jotive/jotive-firebase-logger-module';
constructor(
private readonly logger: LoggerService,
) {
// verify connection configuration
this.transporter.verify((error, success) => {
this.logger.errorObj(error);
});
}