forked from aws/aws-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(kinesisfirehose-destinations): refactor logging to combine logG…
…roup and logging properties into loggingConfig
- Loading branch information
Showing
8 changed files
with
91 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
packages/@aws-cdk/aws-kinesisfirehose-destinations-alpha/lib/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './common'; | ||
export * from './s3-bucket'; | ||
export * from './logging-config'; |
58 changes: 58 additions & 0 deletions
58
packages/@aws-cdk/aws-kinesisfirehose-destinations-alpha/lib/logging-config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import * as logs from 'aws-cdk-lib/aws-logs'; | ||
|
||
/** | ||
* Represents the logging configuration for error logs. | ||
* | ||
* This class defines whether logging is enabled or disabled and holds | ||
* the CloudWatch log group where error logs are stored if logging is enabled. | ||
* | ||
* Subclasses must implement whether logging is enabled (`EnableLogging`) | ||
* or disabled (`DisableLogging`). | ||
*/ | ||
export abstract class LoggingConfig { | ||
/** | ||
* If true, log errors when data transformation or data delivery fails. | ||
* | ||
* `true` when using `EnableLogging`, `false` when using `DisableLogging`. | ||
*/ | ||
public abstract logging: boolean; | ||
|
||
/** | ||
* The CloudWatch log group where log streams will be created to hold error logs. | ||
* | ||
* @default - if `logging` is set to `true`, a log group will be created for you. | ||
*/ | ||
public logGroup?: logs.ILogGroup; | ||
} | ||
|
||
/** | ||
* Enables logging for error logs with an optional custom CloudWatch log group. | ||
* | ||
* When this class is used, logging is enabled (`logging: true`) and | ||
* you can optionally provide a CloudWatch log group for storing the error logs. | ||
* | ||
* If no log group is provided, a default one will be created automatically. | ||
*/ | ||
export class EnableLogging extends LoggingConfig { | ||
public logging: boolean = true; | ||
|
||
constructor(logGroup?: logs.ILogGroup) { | ||
super(); | ||
this.logGroup = logGroup; | ||
} | ||
} | ||
|
||
/** | ||
* Disables logging for error logs. | ||
* | ||
* When this class is used, logging is disabled (`logging: false`) | ||
* and no CloudWatch log group can be specified. | ||
*/ | ||
export class DisableLogging extends LoggingConfig { | ||
public logging: boolean = false; | ||
|
||
constructor() { | ||
super(); | ||
// No logGroup should be allowed when logging is disabled | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters