dart_cloud_logger 0.2.1 copy "dart_cloud_logger: ^0.2.1" to clipboard
dart_cloud_logger: ^0.2.1 copied to clipboard

A simple logging utility for Dart cloud functions

Features #

A simple logging utility for Dart cloud functions with support for error, debug, and info levels.

Getting started #

Add the package to your pubspec.yaml:

dependencies:
  dart_cloud_logger: ^0.2.1

Usage #

import 'package:dart_cloud_logger/dart_cloud_logger.dart';

class MyLogger extends CloudDartFunctionLogger {
  @override
  void printLog(LoggerTypeAction logger, String message, {Map<String, dynamic>? metadata}) {
    // Implement your logging logic here
    print('${logger.name.toUpperCase()}: $message');
    if (metadata != null) {
      print('  Metadata: $metadata');
    }
  }
}

void main() {
  var logger = MyLogger();
  logger.printLog(LoggerTypeAction.error, "This is an error message");
  logger.printLog(LoggerTypeAction.debug, "This is a debug message");
  logger.printLog(LoggerTypeAction.info, "This is an info message", metadata: {"source": "example"});
}

Additional information #

This package is designed to be used in cloud function environments where structured logging is needed. It provides a simple interface for logging at different levels (error, debug, info) and can be easily extended to support other logging backends.

For more information, visit the GitHub repository.

0
likes
150
points
43
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A simple logging utility for Dart cloud functions

Repository (GitHub)

License

MIT (license)

More

Packages that depend on dart_cloud_logger