CloudWatch class

An AWS CloudWatch interface to easily send logs to CloudWatch

Constructors

CloudWatch({required String awsAccessKey, required String awsSecretKey, required String region, required String groupName, required String streamName, String? awsSessionToken, Duration delay = const Duration(milliseconds: 200), Duration requestTimeout = const Duration(seconds: 10), int retries = 3, bool useDynamicTimeout = true, double timeoutMultiplier = 1.2, Duration dynamicTimeoutMax = const Duration(minutes: 2), CloudWatchLargeMessages largeMessageBehavior = CloudWatchLargeMessages.split, bool raiseFailedLookups = false, int maxBytesPerMessage = awsMaxBytesPerMessage, int maxBytesPerRequest = awsMaxBytesPerRequest, int maxMessagesPerRequest = awsMaxMessagesPerRequest})
CloudWatch Constructor

Properties

awsAccessKey String
Public AWS access key
getter/setter pair
awsSecretKey String
Private AWS access key
getter/setter pair
awsSessionToken String?
AWS session token (temporary credentials)
getter/setter pair
delay Duration
How long to wait between requests to avoid rate limiting (suggested value is Duration(milliseconds: 200))
getter/setter pair
dynamicTimeoutMax Duration
The maximum length dynamic timeouts can be
getter/setter pair
groupName String
The log group the log stream will appear under
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
largeMessageBehavior CloudWatchLargeMessages
How messages larger than AWS limit should be handled. Default is truncate.
getter/setter pair
logGroupName String
Synonym for groupName
getter/setter pair
logStreamName String
Synonym for streamName
getter/setter pair
maxBytesPerMessage int
Changes how large each message can be before largeMessageBehavior takes effect. Min 5, Max 262116
getter/setter pair
maxBytesPerRequest int
Changes how many bytes can be sent in each API request before a second request is made. Min 1, Max 1048576
getter/setter pair
maxMessagesPerRequest int
Changes the maximum number of messages that can be sent in each API request. Min 1, Max 10000
getter/setter pair
raiseFailedLookups bool
Whether exceptions should be raised on failed lookups (usually no internet)
getter/setter pair
region String
AWS region
getter/setter pair
requestTimeout Duration
How long to wait for request before triggering a timeout
getter/setter pair
retries int
How many times an api request should be retired upon failure. Default is 3
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
streamName String
The log stream name for log events to be filed in
getter/setter pair
timeoutMultiplier double
How much to increase the timeout after a timeout occurs
getter/setter pair
useDynamicTimeout bool
Whether to dynamically adjust the timeout or not
getter/setter pair

Methods

log(String logString) Future<void>
Sends a log to AWS
logMany(List<String> logStrings) Future<void>
Sends a log to AWS
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited