Giter Club home page Giter Club logo

full-logger's Introduction

Full Logger

Easy to use logger for Rust

Features

  • Support few file formats.
  • Console log.
  • Message box using fltk.
  • Support logs of Result and Option.

Formats

INI

Full support

Example

[error]
Y2023_M2_D21_H18_M59_S27_ML1677002367767 = Test
Y2023_M2_D21_H18_M59_S27_ML1677002367775 = RESULT_OK_"Test"

TOML

Full support

Example

[error]
Y2023_M2_D21_H18_M57_S50_ML1677002270145 = "Test"
Y2023_M2_D21_H18_M57_S50_ML1677002270150 = "RESULT_OK_\"Test\""

CSV

Full support

Example

2023-02-21 19:00:17.771215200 +01:00;error;Test;
2023-02-21 19:00:17.777826800 +01:00;error;RESULT_OK_"Test";

Getting-Started

  1. Manage Log Files
let working_dir = String::from("log");
let max_file_size = FileSize::Mo(100);
let file_manager = FileManager::new(working_dir, max_file_size);

// Get file path to a file under max_file_size (create one if necessary)
let file = file_manager.get_file_path();

// Allow console printing
set_allow_console_log(true);

// Setup simple logs
set_or_create_global_log_file("log", FileSize::Mo(100));

// Add a message box when the log is an error.
set_message_box_trigger("error");
  1. Set the file format
// Do not need other code
set_file_format(FileFormat::CSV);
  1. Time to Log
let path = vec!["error", "debug"];
let message = "Test";

let mut error = Result::<i32, i32>::Ok(12);

log(file, path, message);
error = log_result(file, path, error);

// Or you can use the simple way (must have defined a global file before)
simple_log(log, path, message);
error = simple_log_result(log, path, error);
  1. Enjoy

Here it's the result of a log calling log(file, path, message);

2023-02-21 19:00:17.771215200 +01:00;error;debug;Test;

full-logger's People

Contributors

evisualuser avatar

Stargazers

 avatar

Watchers

 avatar

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.