Coder Social home page Coder Social logo

emodebug's Introduction

Emodebug

This repository has moved to https://github.com/teal-finance/emo

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 zone attribute to prefix the messages:

const EmoDebug _ = EmoDebug(zone: "http service");
// the messages will be prefixed by [http service] :
_.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(deactivatePrint: 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");

emodebug's People

Contributors

synw avatar robert3141 avatar

Stargazers

 avatar  avatar  avatar O. Libre avatar

Watchers

James Cloos avatar  avatar  avatar

emodebug's Issues

Null safety

I know this is a relatively new feature. However, now that all your dependencies support it, please can you release a null safe version of the package (here's a link to help)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.