add ad service
This commit is contained in:
parent
6b8ea07929
commit
9b612ce083
|
@ -6,91 +6,91 @@ import { level } from './logger/level.enum';
|
|||
import loggerOptions from './logger/logger';
|
||||
|
||||
@Controller()
|
||||
export class UserController {
|
||||
export class AdController {
|
||||
constructor(
|
||||
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
|
||||
) {}
|
||||
|
||||
@RabbitSubscribe({
|
||||
name: 'loggingUserCreateInfo',
|
||||
name: 'loggingAdCreateInfo',
|
||||
})
|
||||
public async userCreatedInfoHandler(message: string) {
|
||||
this.logger.configure(loggerOptions('user', level.info, 'info', 'create'));
|
||||
public async adCreatedInfoHandler(message: string) {
|
||||
this.logger.configure(loggerOptions('ad', level.info, 'info', 'create'));
|
||||
this.logger.info(JSON.parse(message));
|
||||
}
|
||||
|
||||
@RabbitSubscribe({
|
||||
name: 'loggingUserCreateWarning',
|
||||
name: 'loggingAdCreateWarning',
|
||||
})
|
||||
public async userCreatedWarningHandler(message: string) {
|
||||
public async adCreatedWarningHandler(message: string) {
|
||||
this.logger.configure(
|
||||
loggerOptions('user', level.warning, 'warning', 'create'),
|
||||
loggerOptions('ad', level.warning, 'warning', 'create'),
|
||||
);
|
||||
this.logger.warning(JSON.parse(message));
|
||||
}
|
||||
|
||||
@RabbitSubscribe({
|
||||
name: 'loggingUserCreateCrit',
|
||||
name: 'loggingAdCreateCrit',
|
||||
})
|
||||
public async userCreatedCriticalHandler(message: string) {
|
||||
public async adCreatedCriticalHandler(message: string) {
|
||||
this.logger.configure(
|
||||
loggerOptions('user', level.crit, 'critical', 'create'),
|
||||
loggerOptions('ad', level.crit, 'critical', 'create'),
|
||||
);
|
||||
this.logger.crit(JSON.parse(message));
|
||||
}
|
||||
|
||||
@RabbitSubscribe({
|
||||
name: 'loggingUserDeleteInfo',
|
||||
name: 'loggingAdDeleteInfo',
|
||||
})
|
||||
public async userDeletedInfoHandler(message: string) {
|
||||
this.logger.configure(loggerOptions('user', level.info, 'info', 'delete'));
|
||||
public async adDeletedInfoHandler(message: string) {
|
||||
this.logger.configure(loggerOptions('ad', level.info, 'info', 'delete'));
|
||||
this.logger.info(JSON.parse(message));
|
||||
}
|
||||
|
||||
@RabbitSubscribe({
|
||||
name: 'loggingUserDeleteCrit',
|
||||
name: 'loggingAdDeleteCrit',
|
||||
})
|
||||
public async userDeletedCriticalHandler(message: string) {
|
||||
public async adDeletedCriticalHandler(message: string) {
|
||||
this.logger.configure(
|
||||
loggerOptions('user', level.crit, 'critical', 'delete'),
|
||||
loggerOptions('ad', level.crit, 'critical', 'delete'),
|
||||
);
|
||||
this.logger.crit(JSON.parse(message));
|
||||
}
|
||||
|
||||
@RabbitSubscribe({
|
||||
name: 'loggingUserReadWarning',
|
||||
name: 'loggingAdReadWarning',
|
||||
})
|
||||
public async userReadWarningHandler(message: string) {
|
||||
public async adReadWarningHandler(message: string) {
|
||||
this.logger.configure(
|
||||
loggerOptions('user', level.warning, 'warning', 'read'),
|
||||
loggerOptions('ad', level.warning, 'warning', 'read'),
|
||||
);
|
||||
this.logger.warning(JSON.parse(message));
|
||||
}
|
||||
|
||||
@RabbitSubscribe({
|
||||
name: 'loggingUserUpdateInfo',
|
||||
name: 'loggingAdUpdateInfo',
|
||||
})
|
||||
public async userUpdatedInfoHandler(message: string) {
|
||||
this.logger.configure(loggerOptions('user', level.info, 'info', 'update'));
|
||||
public async adUpdatedInfoHandler(message: string) {
|
||||
this.logger.configure(loggerOptions('ad', level.info, 'info', 'update'));
|
||||
this.logger.info(JSON.parse(message));
|
||||
}
|
||||
|
||||
@RabbitSubscribe({
|
||||
name: 'loggingUserUpdateCrit',
|
||||
name: 'loggingAdUpdateCrit',
|
||||
})
|
||||
public async userUpdatedCriticalHandler(message: string) {
|
||||
public async adUpdatedCriticalHandler(message: string) {
|
||||
this.logger.configure(
|
||||
loggerOptions('user', level.crit, 'critical', 'update'),
|
||||
loggerOptions('ad', level.crit, 'critical', 'update'),
|
||||
);
|
||||
this.logger.crit(JSON.parse(message));
|
||||
}
|
||||
|
||||
@RabbitSubscribe({
|
||||
name: 'loggingUserHealthCrit',
|
||||
name: 'loggingAdHealthCrit',
|
||||
})
|
||||
public async userHealthCriticalHandler(message: string) {
|
||||
public async adHealthCriticalHandler(message: string) {
|
||||
this.logger.configure(
|
||||
loggerOptions('user', level.crit, 'critical', 'health'),
|
||||
loggerOptions('ad', level.crit, 'critical', 'health'),
|
||||
);
|
||||
this.logger.crit(JSON.parse(message));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue