Git Product home page Git Product logo

mini-log's Introduction

Mini-Log

Mini-Log is a minimum structual-logging library. Header-Only and simple to use.

How to use Mini-Log

  1. get boost
  2. Clone Mini-Log into your project-folder
  3. include miniLog.hpp
  4. include
  5. set a 'const std::string log_path {"./my/relative/path/to/log.txt"};'
  6. build a 'miniLog::miniLogger myLogger{log_path, "Application Name"};'

There is your Logger.

When it comes to compilation, please add -lboost_system to your compiler-flags.

Log a Message

Mini-Log has a miniMessage Type. If you want to log a message just use

miniLog::miniMessage myMessage{miniLog::message_T::status, std::string{"my status message"}

If you finally want to write your message apply it with myLogger.log(myMessage); Mini-Log also features miniLog::miniMessage_T::error and miniLog::miniMessage_T::warning.

Mini-Log will append all messages in that file. To clear it, simply rm your logfile.txt.

mini-log's People

Stargazers

Lukas Güldenstein avatar  avatar proxy-hatch avatar Bepartofyou-七曦 avatar Álvaro García León avatar Odin Holmes avatar Rene Kita avatar

Watchers

James Cloos avatar Stephanos avatar Lukas Güldenstein avatar

Forkers

odinthenerd

mini-log's Issues

coding style

using namespaces in headers is bad style. at least move this https://github.com/bjoekeldude/Mini-Log/blob/fba2a2b813fc0a29cd53c90cd2905fa4c6bfd51c/miniLog.hpp#L10 into your miniLog namespace

https://github.com/bjoekeldude/Mini-Log/blob/master/miniLog.hpp#L15 your already in the miniLog namespace, maybe just name it msgType? https://github.com/bjoekeldude/Mini-Log/blob/master/miniLog.hpp#L16 also maybe just message?
https://github.com/bjoekeldude/Mini-Log/blob/master/miniLog.hpp#L17 already in a struct called message maybe just _time, _type and _str? also a special naming convention for member variables is a good idea, underscore prefix is not a bad choice.

https://github.com/bjoekeldude/Mini-Log/blob/master/miniLog.hpp#L21, since you are making a copy of the input string any way, would be better to take by value and move it into the member variable.

https://github.com/bjoekeldude/Mini-Log/blob/master/miniLog.hpp#L32 strftime returns the new length, would be good to resize the string to the proper length.

s.resize(std::strftime(&s[0], s.size(), "%Y-%m-%d %H:%M:%S", std::localtime(&now)));

https://github.com/bjoekeldude/Mini-Log/blob/master/miniLog.hpp#L36
maybe make both of these into getTimeString functions into member functions of the message

https://github.com/bjoekeldude/Mini-Log/blob/master/miniLog.hpp#L59 should probably not be copyable, what would copying a logger even mean? use = delete after a constructor to remove it.

https://github.com/bjoekeldude/Mini-Log/blob/master/miniLog.hpp#L60 path should probably be private

https://github.com/bjoekeldude/Mini-Log/blob/master/miniLog.hpp#L62 since your storing a copy might as well take by value and move it in

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.