LoggerOptions class
This class represents the logger options.
Instance of LoggerOptions can be passed to the Bot / Bot instance. This will setup logging the request and response data your bot makes.
This will be useful in cases like debugging your code, etc.
Example:
final bot = Bot(
"<YOUR TOKEN>",
loggerOptions: LoggerOptions(
methods: [
APIMethod.sendMessage,
APIMethod.getMe,
],
),
);
Constructors
-
LoggerOptions({bool request = true, bool requestHeader = true, bool requestBody = true, bool responseHeader = true, bool responseBody = true, bool error = true, bool stackTrace = true, void logPrint(Object? object) = _debugPrint, List<
APIMethod> ? methods, bool prettyPrint = true}) -
Creates a new LoggerOptions instance. This can be used to configure logging the
request and response data Televerse makes and receives.
const
-
LoggerOptions.only({bool request = false, bool requestHeader = false, bool requestBody = false, bool responseHeader = false, bool responseBody = false, bool error = false, bool stackTrace = false, void logPrint(Object? object) = _debugPrint, List<
APIMethod> ? methods, bool prettyPrint = true}) -
Creates a new LoggerOptions instance with only specified configuration.
const
Properties
- error → bool
-
Print error message
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- interceptor → Interceptor
-
Returns the interceptor to be used in
Dio
.no setter - logPrint → void Function(Object? object)
-
Log printer; defaults print log to console.
final
-
methods
→ List<
APIMethod> -
Methods to be logged.
final
- prettyPrint → bool
-
Should the logger pretty print the response body
final
- request → bool
-
Print request
Options
final - requestBody → bool
-
Print request data
Options
final - requestHeader → bool
-
Print request header
Options.headers
final - responseBody → bool
-
Print
Response.data
final - responseHeader → bool
-
Print
Response.headers
final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stackTrace → bool
-
Print error stack trace
DioException.stackTrace
final
Methods
-
isAllowed(
APIMethod method) → bool -
Returns true if the given
method
is allowed. -
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