color_log 0.0.6 copy "color_log: ^0.0.6" to clipboard
color_log: ^0.0.6 copied to clipboard

ColorLog is a colorful Flutter logging package with emojis for more expressive and readable logs, simplifying debugging.

pub package Last Commits Pull Requests Code size License

ColorLog is a Flutter package that provides colorful and emoji-filled logs, making them more noticeable and easier to read.

By using this package, developers can customize their log output, avoiding the usual messy blue text.

With different emojis included, logs become more expressive and eye-catching.

Please show support for the project by

liking ❤️ and starring ⭐⭐⭐⭐⭐ the repo, and don't forget to share ✈️ it with other developers.

                                        I ❤️ love emoji

Features #

This package has 8 varities of log

  • info : This will help the developer to get info
  • warning: To see the warning
  • error: To check the error, add it in the api call, catch
  • debug: To use while debuging
  • checkSuccess: To check boolean value, which will give print the log in true and false
  • custom: This will give you freedom to use color, emoji and log type of your choice,

Getting started #

Search for the package color log in pub.dev

Usage #

    class Home extends StatelessWidget {
  const Home({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Button(
              onTap: () {
                clog.info("This is debug log");
              },
              text: "info",
              color: Colors.cyan,
            ),
            Button(
              onTap: () {
                clog.warning("This is warning log");
              },
              text: "warning",
              color: Colors.yellow,
            ),
            Button(
              onTap: () {
                clog.error("This is error log");
              },
              text: "error",
              color: Colors.red,
            ),
            Button(
              onTap: () {
                try {
                  throw Exception;
                } catch (e) {
                  clog.error(e.toString());
                  rethrow;
                }
              },
              text: "error with stacktrace",
              color: Colors.red,
            ),
            Button(
              onTap: () {
                clog.debug("This is debug log");
              },
              text: "debug",
              color: Colors.yellow,
            ),
            Button(
              onTap: () {
                clog.checkSuccess(1 == 1, "This is debug log");
              },
              text: "checkSuccess true",
              color: Colors.green,
            ),
            Button(
              onTap: () {
                clog.checkSuccess(1 != 1, "This is debug log");
              },
              text: "checkSuccess false",
              color: Colors.red,
            ),
            Button(
              onTap: () {
                clog.todo("This is TODO");
              },
              text: "TODO",
              color: Colors.pink,
            ),
            Button(
              onTap: () {
                clog.custom(
                    ansiColor: "\x1b[38;5;205m",
                    emoji: "🤓",
                    logType: "custom",
                    message: "This is custom");
              },
              text: "custom",
              color: Colors.pink,
            ),
          ],
        ),
      ),
    );
  }
}

class Button extends StatelessWidget {
  const Button({super.key, this.onTap, this.text, this.color});
  final VoidCallback? onTap;
  final String? text;
  final Color? color;

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 50,
      color: color,
      margin: const EdgeInsets.all(16),
      width: MediaQuery.of(context).size.width,
      child: ElevatedButton(
        // style: MaterialStateProperty.all(value),
        style: ElevatedButton.styleFrom(
          backgroundColor: color,
        ),

        onPressed: onTap,
        onHover: (c) {},
        child: Text(
          text!,
        ),
      ),
    );
  }
}



String temp = "colorLog"
clog.info($temp);
clog.warning($temp);
clog.error($temp);
clog.debug($temp);
clog.checkSuccess(1 == 1, "TO Verify 1==1");
clog.checkSuccess(1 == 2, "TO Verify 1==2");
clog.custom(message: "This is custom log", emoji: "🍃" , ansiColor: "Any ANSI color", logType: "custom");


Additional information #

To see more detail go to github

created by Aditechdev.

4
likes
160
pub points
59%
popularity

Publisher

unverified uploader

ColorLog is a colorful Flutter logging package with emojis for more expressive and readable logs, simplifying debugging.

Repository (GitHub)
View/report issues

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

flutter

More

Packages that depend on color_log