emodebug 0.3.0 copy "emodebug: ^0.3.0" to clipboard
emodebug: ^0.3.0 copied to clipboard

outdated

Emoji based semantic debuging. Debug the state and execution flow of a program with familiar idioms

Emodebug #

pub package doc

Emoji based semantic debuging:

  • Debug the state and execution flow of your program using familiar idioms
  • Scoped debuging: activate debug locally
  • Easy implementation of custom debug methods: extend the EmoDebug class to create your own methods

Looking at the console you get an intuitive global view on the execution flow:

Screenshot

Note: this is not for error management, you can use Err and ErrRouter to manage the errors.

Example #

import 'package:emodebug/emodebug.dart';

const EmoDebug debug = EmoDebug();

debug.state("A state operation");
debug.save("Saving something");
debug.delete("Deleting something");
debug.update("Updating something");
debug.ok("Everything is ok");
// or from an emoji using any object or a string
debug.emo("📢", obj);

Available methods: check the api documentation

Parameters #

The methods accept any object as parameter (dynamic)

An optional domain positional parameter is available for a more precise message:

final data = {"foo": "bar"};
debug.data(data, "some data");
// output:
// 💼 Some data: {foo: bar}

Scoped debuging #

The recommended way is to use local EmoDebug instances to be able to enable and disable debug messages for a defined portion of code. Use the level attribute to prefix the messages:

const EmoDebug debug = EmoDebug(level: "http service");
// the messages will be prefixed by [http service] :
debug.notFound(path, "page not found");
// output:
// 🚫 [http service] Page not found: /some_page.html

Deactivation #

It is possible to deactivate the printing of the messages for an instance:

// on top of a file
const EmoDebug debug = EmoDebug(deactivate: true);

Implement custom debug methods #

const CustomEmoDebug debug = CustomEmoDebug();

class CustomEmoDebug extends EmoDebug {
  const CustomEmoDebug();

  void crash(dynamic obj, [String domain]) => emo("💥", obj, domain);

  void recovery(dynamic obj, [String domain]) => emo("👍", obj, domain);
}

// in the code
debug.crash("A crash occured!!!");
debug.recovery("Recovery successful");
2
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Emoji based semantic debuging. Debug the state and execution flow of a program with familiar idioms

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

extra_pedantic, pedantic

More

Packages that depend on emodebug