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

To help the developer to get colourful log.

ColorLog is a flutter package to help the developer get noticible Log with color and emoji 💔✅

  • This package will help the developer to get there log different from the messy blue color text

  • There different emoji make the log noticible

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

4
likes
0
pub points
58%
popularity

Publisher

unverified uploader

To help the developer to get colourful log.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on color_log