Coder Social home page Coder Social logo

logs's Introduction

logs

A lightweight Dart logging framework

Build Status


Background and motivation can be found in the associated flutter tracking issue: flutter#21504.

Some relevant implementation considerations can be found in the discussion around proposed changes to flutter foundation (flutter#21505 and flutter#22041).

logs's People

Contributors

devoncarew avatar pq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

logs's Issues

consider a logData call (and support for markers)

From #3 (review):

I wonder if we should have both a log() call and a logData() call. Are we ok with only being able to log objects (jsonable objects), or do we want the ability to log string messages as well?

Regarding markers:

For a data pipeline for tools, just logging objects works. But people may want to log marker events as well:

log.log('cache', 'evicting $number cache entries');
log.logData('cache', entries.first);
...
log.logData('cache', entries.last);

open question about logging data objects

The current plan is to support this by converting them to json, then logging them through the String message param in the dart:developer API.

I'm not sure this will support all use cases (but haven't thought this through in detail). There are some advantages to allowing an object to be logged, ala the inspect(Object data) call (https://api.dartlang.org/be/158637/dart-developer/inspect.html). The reference to it is sent over the service protocol, and the original object still exists in the VM side of the wire to interact with.

[meta] ensure programmatic API has parity w/ service protocol comms

Kind of a meta-issue but it's likely that some folks will prefer programmatic logging configuration (see for example, #22) so we should make sure that anything that can be done via service calls can also be done programmatically. (In particular this serves the common pattern of a dedicated main_dev.dart to configure logging and debugging options.)

(re)consider initialization

Currently logging channels need to have been registered before they can be enabled. This ends up being complicated for clients.

An easy fix would be to track enablement irrespective of registration.

Not sure there are any downsides...

/cc @devoncarew

support remote logging

Related to #21, @matthewtsmith and @johnpryan described a desire to log remotely.

Use case: would like to redirect logging output to firebase to capture debugging data from devices in the wild.

https://github.com/SwiftyBeaver/SwiftyBeaver came up as a reference point.

I think for us to support this we just need something as simple as a listener interface a la package:logging where you can do something like:

Logger.root.level = Level.ALL;
Logger.root.onRecord.listen((record) {
  // redirect here...
});

/cc @devoncarew

address all TODOs in `http` logging

Currently there are a number of places we'll potentially spam stdout w/ "TODO" messages.

AIs:

  • identify calls we want to log
  • implement them
  • remove all remaining _todo() calls

consider auto-registering vm service protocol registration

It would be great to avoid needing to explicitly initialize VM service hooks.

That is, it would be nice to do away w/ the need to call:

logManager.initServiceExtensions();

Thoughts:

  1. we could do this proactively in the manager (con: carry the cost of an extra service extension even if it's not used; pro: would work in profile / release and not require any code changes or client footwork)
  2. clients could do this (e.g., IntelliJ could use EvalOnDartLibrary to call something like initServiceExtensions()) -- con: only works for apps being debugged

improve log API

Follow-up from #16 (comment), minimally we should add:

  • a toEncodable callback (#10)
  • logError and
  • support for data objects

@devoncarew: would 2 calls be sufficient?:

void log(MessageCallback messageCallback, {Object data, toEncodable(object)});

void logError(MessageCallback messageCallback, {Object error, toEncodable(object), StackTrace stackTrace});

Or do you think there's benefit in making a distinction between log and logData?

logging a string changes it's value slightly

Right now, the api converts all logged objects into their jsonable equivalent. So, log('foo_channel', () => 'My message') will convert that string param into its jsonable equivalent (which is "My message").

We then essentially get "My message" in the client instead of My message.

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.