GithubHelp home page GithubHelp logo

lucky-nj / log4pascal Goto Github PK

View Code? Open in Web Editor NEW

This project forked from martinusso/log4pascal

0.0 1.0 0.0 39 KB

A simple logging unit for ObjectPascal (Delphi, FreePascal)

License: MIT License

Pascal 100.00%

log4pascal's Introduction

Log4Pascal

Log4pascal is an Open Source project that aims to produce a simple logging unit for ObjectPascal (Delphi, FreePascal).

Log4Pascal is NOT based on the Log4J package from the Apache Software Foundation. Well, just the name.

How to use

Just add the unit Log4Pascal.pas to project.

  • Project -> Add to Project and then locate and choose the file.

Log file

The log file is defined in the unit Log4Pascal, so if you want to change, modify the following line:

initialization
  Logger := TLogger.Create('Log.txt');

Features

  • Disable Logging.
  • SetQuietMode();
  • Enable Logging. By default, logging is enabled.
  • SetNoisyMode();
  • Enable or disable specific logs
  • EnableTraceLog(); EnableDebugLog(); EnableInfoLog(); EnableWarningLog(); EnableErrorLog(); EnableFatalLog();
  • DisableTraceLog(); DisableDebugLog(); DisableInfoLog(); DisableWarningLog(); DisableErrorLog(); DisableFatalLog();
  • Clean up existing log file
  • Clear();
Logs
Logger.Trace('Trace message log');
Logger.Debug('Message is logged only when in debug');
Logger.Info('Normal message log');
Logger.Warning('Warning message log');
Logger.Error('Error message log');
Logger.Fatal('Fatal message log');
Output
TRACE Trace message log [DATETIME HERE]
DEBUG Message is logged only when in debug [DATETIME HERE]
INFO  Normal message log [DATETIME HERE]
WARN  Warning message log [DATETIME HERE]
ERROR Error message log [DATETIME HERE]
FATAL Fatal message log [DATETIME HERE]

Known bugs

Free Pascal

Using Lazarus (Free Pascal) there were 1 errors compiling module: Identifier not found "DebugHook"

So if you want to use the Log4Pascal in Free Pascal, you must delete (or replace) the following line found in Log4Pascal unit:

if DebugHook = 0 then Exit;

License

This software is open source, licensed under the The MIT License (MIT). See LICENSE for details.

log4pascal's People

Contributors

martinusso 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.