Code Monkey home page Code Monkey logo

ysl's Introduction

YSL

💄 YAML Stream Logging, structured Google logging with YAML!

Integrated in yaml-cpp on this branch: https://github.com/MacroBull/yaml-cpp/blob/mymod/include/yaml-cpp/contrib/ysl.hpp

Usage

Use macro YSL instead of LOG, you get a YAML::Emitter-like stream with Google logging output:

#include "ysl.hpp"

#include <yaml-cpp/stlemitter.h>

YSL_FSCOPE(INFO, "Hello Container");
YSL(INFO) << "hello" << YAML::FloatPrecision(3) << std::map<int, float>{{1, 3.4f}, {2, 6.78f}, {3, 9.0f}};
YSL(INFO) << "PI" << YAML::Flow << std::vector<int>{3, 1, 4, 1, 5, 9, 2, 6};

Output:

I0926 15:42:30.953778 12990 main.cpp:19] --- # --------------- Hello Container: 0 ------------ # ---
I0926 15:42:30.953805 12990 main.cpp:20] hello:
I0926 15:42:30.953812 12990 main.cpp:20]   1: 3.4
I0926 15:42:30.953830 12990 main.cpp:20]   2: 6.78
I0926 15:42:30.953848 12990 main.cpp:20]   3: 9
I0926 15:42:30.953855 12990 main.cpp:21] PI: [3, 1, 4, 1, 5, 9, 2, 6]

Demo

Try sh demo.sh

TODO

  • more documentation
  • cpp: inline version
  • cpp: add Sequential
  • cpp: implement Scope{Sequential enter, Sequential exit}
  • cpp: add SCOPE(plain), FSCOPE(frame + scope), MSCOPE(key + scope), CSCOPE(key + flow + scope)
  • cpp: add IFSCOPE(frame + id + scope), IMSCOPE(key + id + scope), ICSCOPE(key + id + flow + scope)
  • python: python < 3.6 support
  • python: implement ysl.py with yaml + backends(logging)
  • python: inherited yaml.XXConstructor, XXLoader
  • python: implement protobuf constructor
  • python: add FrameParser.fastforward_to

ysl's People

Contributors

macrobull avatar

Stargazers

 avatar Cong Liu avatar Liyao avatar DataCentric avatar csuzhao avatar 郭正龙, BUAA 可靠飞行控制组 avatar

Watchers

James Cloos avatar  avatar

Forkers

qinghuizhao

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.