Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ezequieljuliano/logging4delphi
API that facilitates the generation of logs in applications developed in Delphi
https://github.com/ezequieljuliano/logging4delphi
Last synced: 8 days ago
JSON representation
API that facilitates the generation of logs in applications developed in Delphi
- Host: GitHub
- URL: https://github.com/ezequieljuliano/logging4delphi
- Owner: ezequieljuliano
- License: apache-2.0
- Created: 2014-05-05T14:48:07.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-11-02T22:14:18.000Z (about 8 years ago)
- Last Synced: 2024-04-16T18:16:20.132Z (7 months ago)
- Language: Pascal
- Homepage:
- Size: 197 KB
- Stars: 10
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Logging For Delphi
==============The Logging4Delphi is an API that facilitates the generation of logs in applications developed in Delphi. With this library you can configure the task of logging in an easy and simple way. Moreover, it enables the use of the framework Log4D that has a lot of classes and methods for generating logs.
Drivers Adapters
=================The Logging4Delphi is available for the following data access drivers:
- Logging with standard adapter;
- Logging with Log4D adapter;External Dependencies
=====================The Logging4Delphi makes use of some external dependencies. Therefore these dependences are included in the project within the "dependencies" folder. If you use the library parser you should add to the Path Log4D.
Using Logging4Delphi
====================The Logging4Delphi requires Delphi 2010 or greater and to use this API will is very simple, you simply add the Search Path of your IDE or your project the following directories:
- Logging4Delphi\src
- Logging4Delphi\dependencies\Log4DExamples
===========
uses
Logging4D,
Logging4D.Impl,
Logging4D.Driver.Standard;procedure LoggingWithStandardAdapter;
var
logging: ILogging;
appender: TLoggerAppender;
fileName: string;
begin
inherited;
fileName := ExtractFilePath(ParamStr(0)) + 'Log.txt';
appender := procedure(msg: string)
var
strList: TStringList;
begin
strList := TStringList.Create;
try
if FileExists(fileName) then
DeleteFile(fileName);
strList.Add(msg);
strList.SaveToFile(fileName);
finally
strList.Free;
end;
end;
logging := TStandardLogging.Create(appender);//Using Logger
logging.Fatal(
TLogger.New
.Keywords(['REST'])
.Owner('AppOne')
.Message('Fatal REST Request Error')
.Marker('Delphi')
);//Using String Message
logging.Fatal('Fatal REST Request Error');
end;procedure LoggingWithLog4DAdapter;
var
logging: ILogging;
begin
logging := TLog4DLogging.Create('Log4D', fileName);
//Using Logger
logging.Fatal(
TLogger.New
.Keywords(['REST'])
.Owner('AppOne')
.Message('Fatal REST Request Error')
.Marker('Delphi')
);//Using String Message
logging.Fatal('Fatal REST Request Error');
end;
**Analyze the unit tests they will assist you.**