Coder Social home page Coder Social logo

roysrc / cpplogger Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 930 KB

A simple lightweight header-only C++ logger

License: GNU General Public License v3.0

C++ 98.59% Makefile 1.41%
header-only cpp logging logging-library typographics-logger asynchronous-logger cpp-11 cpp-17 cpp11 cpp17

cpplogger's Introduction

Hi, I'm Sajeeb Sent from Mailspring

Research Interests

I am interested in building tools that allow us to measure the safety, trustworthiness, and fairness of AI systems for safety-critical, regulated, and scientific domains such as in biomedical and healthcare applications. I am also interested in creating AI systems that intrinsically satisfy the above conditions of safety, trustworthiness, and fairness when deployed to real-world applications. I am particularly interested in exploring ideas from programming languages and software engineering, such as neuro-symbolic programming, program verification, and program synthesis, to achieve this goal.

I am also interested in the application and development of machine learning algorithms for algorithmic and structured data problems such as graphs, sequences, images, and time-series data. Of particular interest are applications of these ideas to solving problems in AI for science, computational drug design, healthcare, and biomedical informatics.

Research Experience

Software Engineer

I lead the Quantitative Light Imaging Laboratory's efforts in software development for data acquisition and analysis, including software-hardware integration and development and deployment of AI tools for solving biomedical problems.

My project revolved around developing the next generation of AI embedded intelligent microscopy systems for non-destructive sample imaging through the integration of ML with SLIM (Spatial Light Interference Microscopy) imaging modality.

Research Assistant - Orbiter Computer Algebra System

I was primarily involved in implementing new and optimizing existing group theory algorithms for the Orbiter computer algebra system (An algebra system for the classification of combinatorial objects) for both CPU and GPU to be run on Summit High Performance Compute Clusters. I optimized one of the core graph theory algorithms used throughout the software for performance improvement of an order of magnitude by using efficient data structures. I have also used machine learning techniques such as deep reinforcement learning to optimize tree-based data structures used to represent the orbits of groups acting on sets in real-time. My approach achieved state-of-the-art results compared to existing algorithms, primarily the Seress shallow Schreier tree algorithm in terms of memory usage and the quality of the generated tree. I have presented this research at the 50th Southeastern International Conference on Combinatorics, Graph Theory & Computing.

Teaching Experience

Teaching Assistant (Operating Systems)

I assisted in teaching the Operating Systems course at Colorado State University. I helped write class assignments, held help sessions and office hours and assisted with class logistics. The assignments ranged from writing scheduling algorithms to multi-process and multi-threaded programs. I was also involved in building an automated grading system to grade student submissions using error carried forward logic.

Some of my projects

Mini-Java Compiler P2P network overlay Scalable Server Design Orbiter CPPLOGGER

Languages and Tools

NOTE: Top languages do not indicate my skill level or anything similar to that, it's a github metric of which languages I have the most code on github.

Sajeeb's github stats Top Langs

cpplogger's People

Contributors

roysrc avatar

Stargazers

 avatar

Watchers

 avatar  avatar

cpplogger's Issues

Make naming consistent

Is your feature request related to a problem? Please describe.
Name inconsistencies in logger. Some places such as when initializing the logger we have logger_init() while to use the logger we need cpplogger_info(...).

Describe the solution you'd like
It would be great to replace cpplogger_info(...) with just logger_info(...). This means less typing and also makes the naming consistent.

Scoped logging

Is your feature request related to a problem? Please describe.
The logger does not have enable or disable functionality within a certain scope.

Describe the solution you'd like
Add functionality to enable or disable logging within a certain scope. take the following example

logger_enable(false);
logger_info("This is before entering a new scope. This message should not be printed");
{
    logger_enable_scope(true);
    logger_info("This is logging in the new scope.");
}
logger_info("This is after leaving the scope. This message should not be printed");

Infinite loop

Describe the bug
Infinite loop in destructor of lock free queue

Scoped logging does not affect global logging.

Describe the bug
Scoped logging does not affect global logging.

To Reproduce

int main() {
	logger_enable(false);
	logger_enable_global(false);
	logger_info("This is before entering a new scope. This message should not be printed");
	{
	    logger_enable_scope(true);
	    logger_info("This is logging in the new scope.");
	}
	logger_info("This is after leaving the scope. This message should not be printed");
	logger_enable(true);
       logger_enable_global(true);
	logger_info("This message is after enabling global logging.");
}

Expected behavior

[INFO]: scoped_logging.cpp:19:: This is logging in the new scope.
[INFO]: scoped_logging.cpp:23:: This message is after enabling global logging.

Desktop (please complete the following information):

  • OS: Ubuntu]
  • Compiler: GNU
  • Version [9.3.0]

Asynchronous Logging

Is your feature request related to a problem? Please describe.
Currently this logger does not have support for asynchronous logging.

Describe the solution you'd like
Implement asynchronous logging using a lock-free fixed length array or queue

Add asynchronous logging for multi-threaded logging

Is your feature request related to a problem? Please describe.
Add support for multi-threaded asynchronous logging.

Describe the solution you'd like
Have a single asynchronous function that does asynchronous logging for both multi-threaded and single threaded

`get_type()` functions possible bug

Describe the bug
There seems to be an issue with the get_type() functions in the following statement:

return string(ptr.get()).c_str();

The string variable is created on the stack and is destroyed when the function scope ends. This causes the pointer to the character array returned to be a dangling pointer. In that it now points to an invalid location in memory.

Disable logging in a single translation unit

Is your feature request related to a problem? Please describe.
The current version does not allow for disabling of logging within a single translation unit. Disabling logging turns off global logging.

Describe the solution you'd like
Add a function that allows disabling global logging and also logging within a single translation unit.

log Class

Hey, is it possible to log a class?

I have e.g. this class:
`class MyClass {
private:
int value;

public:
MyClass(int v) : value(v) {}

// Überladen des <<-Operators für MyClass
friend std::ostream& operator<<(std::ostream& os, const MyClass& obj) {
    os << "MyClass(" << obj.value << ")";
    return os;
}

};`

with the << operator overloaded.
But I can't log it e.g. with
MyClass my(22); logger_info("This is an test", my);

Make verbose level example more descriptive

Is your feature request related to a problem? Please describe.
From the verbose level example it is unclear as to what the user should do. What is the first and the second argument. Is the first argument the current verbose level and the second argument the verbose level at which the log message should be printed or is it the other way around.

Describe the solution you'd like
Provide more description to the verbose level example. Describe what the first and second arguments are.

Add nanosecond resolution

Is your feature request related to a problem? Please describe.
When debugging multi threaded programs it is not sufficient to display timestamps in millisecond since a lot of operations can happen in one millisecond.

Describe the solution you'd like
Add a flag to display timestamps in nanosecond or microsecond resolution.

Add log level

Add log level option to enable or disable certain levels of logging such as [INFO], [ ERR], or [WARN]

Print the contents of array

Is your feature request related to a problem? Please describe.
Add logger function to print the contents of an array similar to python. For example of the array contents are: [1, 2, 3, 4], then the logger array printer function should print: [INFO]: ...: [1, 2, 3, 4]

Compile error when another function named `info` is defined by the user

Describe the bug
When there is another function named info, the compiler generates the following error:

n file included from info.cpp:8:
../CPPLOGGER.h:228:26: error: variable or field ‘_info_’ declared void
  228 |  #define info(...) _info_(__FILE__, __LINE__, __VA_ARGS__)
      |                          ^
info.cpp:13:6: note: in expansion of macro ‘info’
   13 | void info() {
      |      ^~~~
../CPPLOGGER.h:228:58: error: expected primary-expression before ‘)’ token
  228 |  #define info(...) _info_(__FILE__, __LINE__, __VA_ARGS__)
      |                                                          ^
info.cpp:13:6: note: in expansion of macro ‘info’
   13 | void info() {
      |      ^~~~
info.cpp: In function ‘int main()’:
../CPPLOGGER.h:228:58: error: expected primary-expression before ‘)’ token
  228 |  #define info(...) _info_(__FILE__, __LINE__, __VA_ARGS__)
      |                                                          ^
info.cpp:18:2: note: in expansion of macro ‘info’
   18 |  info();
      |  ^~~~
../CPPLOGGER.h:228:20: error: ‘_info_’ was not declared in this scope; did you mean ‘logger::_info_’?
  228 |  #define info(...) _info_(__FILE__, __LINE__, __VA_ARGS__)
      |                    ^~~~~~
info.cpp:18:2: note: in expansion of macro ‘info’
   18 |  info();
      |  ^~~~
../CPPLOGGER.h:236:14: note: ‘logger::_info_’ declared here
  236 |  inline void _info_(const char* _file_, const int line, const char* fmt, ...) {
      |              ^~~~~~

To Reproduce

#include <CPPLOGGER.h>
#include <iostream>

using namespace std;

void info() {
	cout << "info" << endl;
}

int main() {
	info();
}

Expected behavior
The expected behavior should be: info printed on the terminal after successful compilation.

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
  • Compiler: GNU g++
  • Version 9.3.0

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.