dlog 0.0.2
dlog: ^0.0.2 copied to clipboard
A useful library for output structured information of debugging into console
DLog #
A useful library for output structured information of debugging into console
Usage #
A simple usage example:
import "dart:math" as Math;
import 'package:dlog/dlog.dart' as DLog;
double rad(num deg) =>
deg * (Math.PI / 180);
main() {
// create new table and specify number of columns or column names
var debug = new DLog.Table.fromHeader(
["deg°", "radian", "normal"]);
// add more header
debug.columns.addAll(["vector (x, y)"]);
for (int angle = 0; angle < 360; angle++) {
double x = 1 * Math.cos(rad(angle)),
y = 1 * Math.sin(rad(angle)),
normal = 1.0 * x + 0.0 * y;
// add row (count of cell eq debug.columns.length or size property)
debug.data.addAll([angle, rad(angle), normal, [x,y]]);
}
var pi = debug.clone().crop(0, 180),
pi2 = debug.clone().crop(180, 180);
// output to console
print(debug);
// output range 0-179
print(pi);
// output range 180-359
print(pi2);
}
Result:
┌──────┬──────────────────────┬─────────────────────────┬──────────────────────────────────────────────┐
│ DEG° │ RADIAN │ NORMAL │ VECTOR (X, Y) │
├──────┼──────────────────────┼─────────────────────────┼──────────────────────────────────────────────┤
│ 0 │ 0.0 │ 1.0 │ [1.0, 0.0] │
├──────┼──────────────────────┼─────────────────────────┼──────────────────────────────────────────────┤
│ 1 │ 0.017453292519943295 │ 0.9998476951563913 │ [0.9998476951563913, 0.01745240643728351] │
├──────┼──────────────────────┼─────────────────────────┼──────────────────────────────────────────────┤
│ 2 │ 0.03490658503988659 │ 0.9993908270190958 │ [0.9993908270190958, 0.03489949670250097] │
├──────┼──────────────────────┼─────────────────────────┼──────────────────────────────────────────────┤
│ 3 │ 0.05235987755982989 │ 0.9986295347545738 │ [0.9986295347545738, 0.052335956242943835] │
├──────┼──────────────────────┼─────────────────────────┼──────────────────────────────────────────────┤
│ 4 │ 0.06981317007977318 │ 0.9975640502598242 │ [0.9975640502598242, 0.0697564737441253] │
├──────┼──────────────────────┼─────────────────────────┼──────────────────────────────────────────────┤
│ 5 │ 0.08726646259971647 │ 0.9961946980917455 │ [0.9961946980917455, 0.08715574274765817] │
├──────┼──────────────────────┼─────────────────────────┼──────────────────────────────────────────────┤
│ 6 │ 0.10471975511965978 │ 0.9945218953682733 │ [0.9945218953682733, 0.10452846326765347] │
├──────┼──────────────────────┼─────────────────────────┼──────────────────────────────────────────────┤
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
│ 354 │ 6.178465552059927 │ 0.9945218953682733 │ [0.9945218953682733, -0.10452846326765342] │
├──────┼──────────────────────┼─────────────────────────┼──────────────────────────────────────────────┤
│ 355 │ 6.19591884457987 │ 0.9961946980917455 │ [0.9961946980917455, -0.08715574274765832] │
├──────┼──────────────────────┼─────────────────────────┼──────────────────────────────────────────────┤
│ 356 │ 6.213372137099813 │ 0.9975640502598242 │ [0.9975640502598242, -0.06975647374412564] │
├──────┼──────────────────────┼─────────────────────────┼──────────────────────────────────────────────┤
│ 357 │ 6.230825429619756 │ 0.9986295347545738 │ [0.9986295347545738, -0.05233595624294437] │
├──────┼──────────────────────┼─────────────────────────┼──────────────────────────────────────────────┤
│ 358 │ 6.2482787221397 │ 0.9993908270190958 │ [0.9993908270190958, -0.034899496702500823] │
├──────┼──────────────────────┼─────────────────────────┼──────────────────────────────────────────────┤
│ 359 │ 6.265732014659643 │ 0.9998476951563913 │ [0.9998476951563913, -0.01745240643728356] │
└──────┴──────────────────────┴─────────────────────────┴──────────────────────────────────────────────┘
Features and bugs #
Please file feature requests and bugs at the issue tracker.