{"id":18069213,"url":"https://github.com/dliocode/datalogger","last_synced_at":"2025-04-09T17:26:17.227Z","repository":{"id":38076632,"uuid":"347725359","full_name":"dliocode/datalogger","owner":"dliocode","description":"DataLogger foi projetado para ser uma biblioteca simples de log com suporte a vários providers.","archived":false,"fork":false,"pushed_at":"2024-10-10T11:17:10.000Z","size":1875,"stargazers_count":57,"open_issues_count":3,"forks_count":15,"subscribers_count":12,"default_branch":"v3","last_synced_at":"2025-04-02T12:00:06.520Z","etag":null,"topics":["console","datadog","datalogger","delphi","discord","elastic","eventlog","log","logcat","logger","logging","logstach","pascal","redis","rest","slack","telegram","textfile","transaction","twilio"],"latest_commit_sha":null,"homepage":"","language":"Pascal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dliocode.png","metadata":{"files":{"readme":"README.en.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-14T18:52:26.000Z","updated_at":"2024-12-17T19:41:44.000Z","dependencies_parsed_at":"2025-01-15T20:24:19.045Z","dependency_job_id":"1574ee0f-084f-411e-83f1-0ab9108be03a","html_url":"https://github.com/dliocode/datalogger","commit_stats":{"total_commits":316,"total_committers":5,"mean_commits":63.2,"dds":"0.012658227848101222","last_synced_commit":"09cf438e59681c3c6bd9d3f7427f197f7850e618"},"previous_names":[],"tags_count":51,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dliocode%2Fdatalogger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dliocode%2Fdatalogger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dliocode%2Fdatalogger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dliocode%2Fdatalogger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dliocode","download_url":"https://codeload.github.com/dliocode/datalogger/tar.gz/refs/heads/v3","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248076200,"owners_count":21043730,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["console","datadog","datalogger","delphi","discord","elastic","eventlog","log","logcat","logger","logging","logstach","pascal","redis","rest","slack","telegram","textfile","transaction","twilio"],"created_at":"2024-10-31T08:09:36.675Z","updated_at":"2025-04-09T17:26:17.196Z","avatar_url":"https://github.com/dliocode.png","language":"Pascal","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://user-images.githubusercontent.com/54585337/123354958-0f374800-d53b-11eb-8a2b-9c7041cfff47.png\"\u003e\n    \u003cimg alt=\"datalogger\" src=\"https://user-images.githubusercontent.com/54585337/123354958-0f374800-d53b-11eb-8a2b-9c7041cfff47.png\"\u003e\n  \u003c/a\u003e  \n\u003c/p\u003e\n\u003cbr\u003e \n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/v/release/dliocode/datalogger?style=flat-square\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/stars/dliocode/datalogger?style=flat-square\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/forks/dliocode/datalogger?style=flat-square\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/contributors/dliocode/datalogger?color=orange\u0026style=flat-square\"\u003e\n  \u003cimg src=\"https://tokei.rs/b1/github/dliocode/datalogger?color=red\u0026category=lines\"\u003e\n  \u003cimg src=\"https://tokei.rs/b1/github/dliocode/datalogger?color=green\u0026category=code\"\u003e\n  \u003cimg src=\"https://tokei.rs/b1/github/dliocode/datalogger?color=yellow\u0026category=files\"\u003e\n\n  \u003cp align=\"center\"\u003e\n |\n    \u003ca href=\"https://github.com/dliocode/datalogger/blob/v3/README.md\"\u003ePortuguês Brasileiro\u003c/a\u003e |  \n    \u003ca href=\"https://github.com/dliocode/datalogger/blob/v3/README.en.md\"\u003eEnglish\u003c/a\u003e |\n  \u003c/p\u003e\n\u003c/p\u003e\n\n# DataLogger\n\nDataLogger was designed to be a simple logging library with support for many *providers*.\n\nSupport: developer.dlio@gmail.com\n\n## ⚙️ Installation\n\n### To install in your project using [boss](https://github.com/HashLoad/boss):\n\n```sh\n$ boss install github.com/dliocode/datalogger\n```\n\n### Manual Installation\n\nAdd the following folders to your project, under *Project \u003e Options \u003e Delphi Compiler \u003e Search path*\n\n    ../src/Core\n    ../src/Providers\n\n## 📌 Index\n\n*   [How to use](#como-usar)\n*   [Providers](#providers)\n*   [Dependencies](#dependências)\n*   [Extra Information](#informações-extras)\n*   [Examples](#exemplos)\n    *   [Standard Use](#uso-padrão)\n    *   [Create a new DataLogger instance](#criar-uma-nova-instância-do-datalogger)\n    *   [DataLogger Simple](#datalogger-simple)\n    *   [Custom](#custom)\n    *   [Specials](#especiais)\n        *   [SlineBreak](#slinebreak)\n        *   [UndoLast](#undolast)\n    *   [Template (Log Format)](#template-formato-do-log)\n        *   [Constants](#template-constantes)\n    *   [SetTemplate](#settemplate)\n        *   [How to define a template in specific providers](#como-definir-um-template-em-providers-específicos)\n    *   [SetFormatTimestamp](#setformattimestamp)\n    *   [Level](#level)\n    *   [SetLevelName](#setlevelname)\n    *   [SetLevel](#setlevel)\n    *   [SetDisableLevel](#setdisablelevel)\n    *   [SetOnlyLevel](#setonlylevel)\n    *   [SetLogException](#setlogexception)\n    *   [SetMaxRetries](#setmaxretries)\n    *   [SetIgnoreTemplate](#setignoretemplate)\n    *   [SetName](#setname)\n    *   [SetLiveMode](#setlivemode)\n    *   [Transaction](#transaction)\n\n## How to use\n\nThere are two different ways to use DataLogger:\ndirectly through `Logger` or instantiating your own `TDataLogger`.\n\n[Samples](https://github.com/dliocode/datalogger/tree/main/Samples)\n\nThe first is just intended to be a convenient shared log to use across your application if you choose.\n\n*   **Uses required**:\n\n\u003c!----\u003e\n\n    uses DataLogger;\n\n## Providers\n\nOne ***provider*** it essentially serves to store your logs.\nEach instance of a TDataLogger can have several ***providers*** configured.\n\nHere we have a list with **60 *providers*** available:\n\n| Name | Uses | Examples |\n| --- | --- | --- |\n| [AWS CloudWatch](https://aws.amazon.com/cloudwatch) | DataLogger.Provider.AWS.CloudWatch | [AWS CloudWatch](https://github.com/dliocode/datalogger/tree/main/Samples/AWSCloudWatch) |\n| [Axiom](https://axiom.co/) | DataLogger.Provider.Axiom | [Axiom](https://github.com/dliocode/datalogger/tree/main/Samples/Axiom) |\n| [CallMeBot](https://www.callmebot.com/) | DataLogger.Provider.CallMeBot.WhatsApp | [CallMeBot](https://github.com/dliocode/datalogger/tree/main/Samples/CallMeBot) |\n| Console | DataLogger.Provider.Console | [Console](https://github.com/dliocode/datalogger/tree/main/Samples/Console) \u003cbr /\u003e [Console Simple](https://github.com/dliocode/datalogger/tree/main/Samples/Console%20-%20Simple) |\n| [Coralogix](https://coralogix.com/) | DataLogger.Provider.Coralogix | [Coralogix](https://github.com/dliocode/datalogger/tree/main/Samples/Coralogix) |\n| CSV | DataLogger.Provider.CSV | [CSV](https://github.com/dliocode/datalogger/tree/main/Samples/CSV) |\n| [Datadog](https://www.datadoghq.com/) | DataLogger.Provider.Datadog | [Datadog](https://github.com/dliocode/datalogger/tree/main/Samples/Datadog) |\n| [Datalust](https://datalust.co/) | DataLogger.Provider.Datalust | [Datalust](https://github.com/dliocode/datalogger/tree/main/Samples/Datalust) |\n| [Discord](https://discord.com/developers/docs/resources/webhook) | DataLogger.Provider.Discord.WebHook | [DiscordHook](https://github.com/dliocode/datalogger/tree/main/Samples/DiscordHook) |\n| [Dynatrace](https://www.dynatrace.com/) | Data Logger.Provider.Dynatrace | [Dynatrace](https://github.com/dliocode/datalogger/tree/main/Samples/Dynatrace) |\n| [ElasticSearch](https://www.elastic.co/pt/what-is/elasticsearch) | DataLogger.Provider.ElasticSearch | [ElasticSearch](https://github.com/dliocode/datalogger/tree/main/Samples/ElasticSearch) |\n| [Teach him](https://elmah.io/) | DataLogger.Provider.Elmah | [Teach him](https://github.com/dliocode/datalogger/tree/main/Samples/Elmah) |\n| Email | DataLogger.Provider.Email | [Email](https://github.com/dliocode/datalogger/tree/main/Samples/Email) |\n| event log | DataLogger.Provider.EventLog | [EventLog](https://github.com/dliocode/datalogger/tree/main/Samples/EventLog) |\n| Events | DataLogger.Provider.Events | [Events](https://github.com/dliocode/datalogger/tree/main/Samples/Events) \u003cbr /\u003e [Events - With DataSet](https://github.com/dliocode/datalogger/tree/main/Samples/Events%20-%20With%20DataSet) \u003cbr /\u003e [Events - With SQLite](https://github.com/dliocode/datalogger/tree/main/Samples/Events%20-%20With%20SQLLite) |\n| [Firebase](https://firebase.google.com/) | Data Logger.Provider.Firebase.Realtime Database | [Firebase](https://github.com/dliocode/datalogger/tree/main/Samples/Firebase) |\n| [Grafana](https://grafana.com/) | DataLogger.Provider.Grafana.Loki \u003cbr /\u003e datalogger.provider.graphana.oncall.webhook | [Grafana](https://github.com/dliocode/datalogger/tree/main/Samples/Grafana) |\n| [GraphJSON](https://graphjson.com/) | DataLogger.Provider.GraphJSON | [GraphJSON](https://github.com/dliocode/datalogger/tree/main/Samples/GraphJSON) |\n| [Graylog](https://www.graylog.org/) | DataLogger.Provider.Graylog | [Graylog](https://github.com/dliocode/datalogger/tree/main/Samples/Graylog) |\n| HTML | DataLogger.Provider.HTML | [HTML](https://github.com/dliocode/datalogger/tree/main/Samples/HTML) |\n| ListBox | DataLogger.Provider.ListBox | [ListBox](https://github.com/dliocode/datalogger/tree/main/Samples/ListBox) |\n| ListView | DataLogger.Provider.ListView | [ListView](https://github.com/dliocode/datalogger/tree/main/Samples/ListView) |\n| [Logentries](https://logentries.com/) | DataLogger.Provider.Logentries | [Logentries](https://github.com/dliocode/datalogger/tree/main/Samples/Logentries) |\n| [Logflare](https://logflare.app/) | DataLogger.Provider.Logflare | [Logflare](https://github.com/dliocode/datalogger/tree/main/Samples/Logflare) |\n| [Loggly](https://www.loggly.com/) | DataLogger.Provider.Loggly | [Loggly](https://github.com/dliocode/datalogger/tree/main/Samples/Loggly) |\n| [Logstash](https://www.elastic.co/pt/logstash/) | DataLogger.Provider.Logstash | [Logstash](https://github.com/dliocode/datalogger/tree/main/Samples/Logstash) |\n| [Logtail](https://betterstack.com/logtail) | DataLogger.Provider.Logtail | [Logtail](https://github.com/dliocode/datalogger/tree/main/Samples/Logtail) |\n| [Logz](https://logz.io/) | DataLogger.Provider.Logz | [Logz](https://github.com/dliocode/datalogger/tree/main/Samples/Logz) |\n| [Mailgun](https://www.mailgun.com/) | DataLogger.Provider.Mailgun.Api | [Mailgun](https://github.com/dliocode/datalogger/tree/main/Samples/Mailgun-Api) |\n| [Mailjet](https://www.mailjet.com/) | DataLogger.Provider.Mailjet.Api | [Mailjet](https://github.com/dliocode/datalogger/tree/main/Samples/Mailjet-Api) |\n| [Mattermost](https://mattermost.com/) | DataLogger.Provider.Mattermost \u003cbr /\u003e DataLogger.Provider.Mattermost.WebHooks | [Mattermost](https://github.com/dliocode/datalogger/tree/main/Samples/Mattermost) \u003cbr /\u003e [MattermostHook](https://github.com/dliocode/datalogger/tree/main/Samples/MattermostHook) |\n| Memo | DataLogger.Provider.Memo | [Memo](https://github.com/dliocode/datalogger/tree/main/Samples/Memo) \u003cbr /\u003e [Memo and Text File](https://github.com/dliocode/datalogger/tree/main/Samples/Memo%20and%20TexFile) \u003cbr /\u003e [Memo - Only Error/VCL](https://github.com/dliocode/datalogger/tree/main/Samples/Memo%20-%20Only%20Error/VCL) |\n| Memory | DataLogger.Provider.Memory | [Memory](https://github.com/dliocode/datalogger/tree/main/Samples/Memory) |\n| [mezma](https://www.mezmo.com/) | DataLogger.Provider.Mezmo | [mezma](https://github.com/dliocode/datalogger/tree/main/Samples/Mezmo) |\n| [MongoDB](https://www.mongodb.com) | DataLogger.Provider.MongoDB.Cloud | [MongoDB](https://github.com/dliocode/datalogger/tree/main/Samples/MongoDB) |\n| [Ntfy](https://ntfy.sh) | DataLogger.Provider.Ntfy | [Ntfy](https://github.com/dliocode/datalogger/tree/main/Samples/Ntfy) |\n| [NewRelic](https://newrelic.com) | DataLogger.Provider.NewRelic | [NewRelic](https://github.com/dliocode/datalogger/tree/main/Samples/NewRelic) |\n| Notification | DataLogger.Provider.Notification | [Notification](https://github.com/dliocode/datalogger/tree/main/Samples/Notification) |\n| [New](https://novu.co/) | datalogger.provider.pain | [New](https://github.com/dliocode/datalogger/tree/main/Samples/Novu) |\n| OutputDebugString | DataLogger.Provider.OutputDebugString | [OutputDebugString](https://github.com/dliocode/datalogger/tree/main/Samples/OutputDebugString) |\n| [PaperTrail](https://papertrailapp.com) | DataLogger.Provider.PaperTrail | [PaperTrail](https://github.com/dliocode/datalogger/tree/main/Samples/PaperTrail) |\n| [Postmark](https://postmarkapp.com) | DataLogger.Provider.Postmark.Api | [Postmark](https://github.com/dliocode/datalogger/tree/main/Samples/Postmark-Api) |\n| [RabbitMQ](https://github.com/danieleteti/delphistompclient) | DataLogger.Provider.RabbitMQ | [RabbitMQ](https://github.com/dliocode/datalogger/tree/main/Samples/RabbitMQ) |\n| [Redis](https://github.com/danieleteti/delphiredisclient) | DataLogger.Provider.Redis | [Redis](https://github.com/dliocode/datalogger/tree/main/Samples/Redis) |\n| Rest | DataLogger.Provider.REST.HTTPClient \u003cbr /\u003e DataLogger.Provider.REST.Indy \u003cbr /\u003e DataLogger.Provider.REST.NetHTTPClient | [Rest](https://github.com/dliocode/datalogger/tree/main/Samples/REST) |\n| RichEdit | DataLogger.Provider.RichEdit | [RichEdit](https://github.com/dliocode/datalogger/tree/main/Samples/RichEdit) |\n| [Sematext](https://sematext.com/) | DataLogger.Provider.Sematext.Logs | [Sematext-Logs](https://github.com/dliocode/datalogger/tree/main/Samples/Sematext-Logs) |\n| [SendChamp](https://www.sendchamp.com/) | DataLogger.Provider.SendChamp.SMS \u003cbr /\u003e DataLogger.Provider.SendChamp.WhatsApp | [SendEmail](https://github.com/dliocode/datalogger/tree/main/Samples/SendChamp) |\n| [SendEmail](https://github.com/dliocode/sendemail) | DataLogger.Provider.SendEmail | [SendEmail](https://github.com/dliocode/datalogger/tree/main/Samples/SendEmail) |\n| [SendGrid](https://sendgrid.com/) | DataLogger.Provider.SendGrid.WebApi | [SendGridWebApi](https://github.com/dliocode/datalogger/tree/main/Samples/SendGrid-WebApi) |\n| [Slack](https://slack.com/) | DataLogger.Provider.Slack.WebApi \u003cbr /\u003e DataLogger.Provider.Slack.WebHook | [Slack](https://github.com/dliocode/datalogger/tree/main/Samples/Slack) |\n| [Splunk](https://www.splunk.com/) | DataLogger.Provider.Splunk | [Splunk](https://github.com/dliocode/datalogger/tree/main/Samples/Splunk) |\n| Socket | DataLogger.Provider.Socket | [Socket](https://github.com/dliocode/datalogger/tree/main/Samples/Socket) |\n| [SumoLogic](https://www.sumologic.com/) | DataLogger.Provider.SumoLogic | [SumoLogic](https://github.com/dliocode/datalogger/tree/main/Samples/SumoLogic) |\n| SysLog | DataLogger.Provider.SysLog \u003cbr /\u003e DataLogger.Provider.SysLog.Indy | [SysLog](https://github.com/dliocode/datalogger/tree/main/Samples/SysLog) \u003cbr /\u003e [SysLog Indy](https://github.com/dliocode/datalogger/tree/main/Samples/SysLogIndy) |\n| [Telegram](https://core.telegram.org/) | DataLogger.Provider.Telegram | [Telegram](https://github.com/dliocode/datalogger/tree/main/Samples/Telegram) |\n| TextFile | DataLogger.Provider.TextFile | [TextFile](https://github.com/dliocode/datalogger/tree/main/Samples/TextFile) |\n| [UltraMSG](https://ultramsg.com) | DataLogger.Provider.UltraMSG.WhatsApp | [UltraMSG](https://github.com/dliocode/datalogger/tree/main/Samples/UltraMSG) |\n| [Twilio](https://www.twilio.com/) | DataLogger.Provider.Twilio.SMS \u003cbr /\u003e DataLogger.Provider.Twilio.WhatsApp | [Twilio](https://github.com/dliocode/datalogger/tree/main/Samples/Twilio) |\n| [Z-API](https://z-api.io/) | DataLogger.Provider.ZAPI.WhatsApp | [Z-API](https://github.com/dliocode/datalogger/tree/main/Samples/ZAPI) |\n\n## Dependencies\n\nThese dependencies occur when using some *providers*\n\n| Provider | Dependency |\n| --- | --- |\n| DataLogger.Provider.RabbitMQ | [RabbitMQ](https://github.com/danieleteti/delphistompclient) |\n| DataLogger.Provider.Redis | [Redis](https://github.com/danieleteti/delphiredisclient) |\n| DataLogger.Provider.SendEmail | [SendEmail](https://github.com/dliocode/sendemail) |\n\n## Extra Information\n\n### Plataforma Android:\n\nPermission is required **ACCESS_WIFI_STATE**: Used to capture the MAC Address of the device.\n\n## Examples\n\n### Standard Use\n\n```delphi\nuses\n  DataLogger,\n  DataLogger.Provider.Console;\n\nbegin\n  Logger.AddProvider(TProviderConsole.Create);\n\n  Logger\n    .Trace('My Trace')\n    .Debug('My Debug')\n    .Info('My Info')\n    .Warn('My Warn')\n    .Error('My Error')\n    .Success('My Success')\n    .Fatal('My Fatal')\n    .Custom('Custom Level', 'My Custom')\n    ;\n\n  // or\n\n  Logger\n    .T('My Trace')\n    .D('My Debug')\n    .I('My Info')\n    .W('My Warn')\n    .E('My Error')\n    .S('My Success')\n    .F('My Fatal')\n    .C('Custom Level', 'My Custom')\n    ;\n\n  Readln;\n\nend.\n```\n\n### Create a new DataLogger instance\n\n```delphi\nuses\n  DataLogger,\n  DataLogger.Provider.Console;\n\nvar\n  LCustomLogger: TDataLogger;\nbegin\n  LCustomLogger := TDataLogger.Builder;\n  LCustomLogger.AddProvider(TProviderConsole.Create);\n\n  LCustomLogger\n    .Trace('My Trace')\n    .Debug('My Debug')\n    .Info('My Info')\n    .Warn('My Warn')\n    .Error('My Error')\n    .Success('My Success')\n    .Fatal('My Fatal')\n    .Custom('Custom Level', 'My message with custom level');\n  Readln;\nend.\n```\n\n### DataLogger Simple\n\n```delphi\nuses\n  DataLogger,\n  DataLogger.Simple,\n  DataLogger.Provider.Console;\n\nbegin\n  // Defini o provider\n  Logger.AddProvider(TProviderConsole.Create);\n\n  //Defini no DataloggerSimple a instância do log a ser utilizado\n  TDataLoggerSimple.SetDataLogger(Logger);\n\n  // Só usar o modo simples;\n  Trace('My message Trace');\n  Debug('My message debug');\n  Info('My message info');\n  Success('My message success');\n  Warn('My message warn');\n  Error('My message error');\n  Fatal('My message fatal');\n  Custom('My Type', 'My message custom');\n\n  Readln;\nend.\n\n```\n\n## Custom\n\nO *Custom* is how to define a name for your own *level*.\n\n```delphi\nuses\n  DataLogger,\n  DataLogger.Provider.Console;\n\nbegin\n  Logger.AddProvider(TProviderConsole.Create);\n  Logger.SetTemplate('${timestamp} [${level}] ${message}');\n\n  Logger.Custom('Custom Level', 'My message with custom level!');\n\n  // Output: 2022-12-01 09:00:05.500 [Custom Level] My message with custom level!\n\n  Readln;\nend.\n```\n\n## Specials\n\nFunctions that operate on some providers.\n\n```delphi\n  // Pula uma linha\n  Logger.SlineBreak;\n\n  // Desfaz o último log registrado\n  Logger.UndoLast;\n```\n\n### SlineBreak\n\nThe function `SlineBreak` using to make the line break.\n\n```delphi\nuses\n  DataLogger,\n  DataLogger.Provider.Console;\n\nbegin\n  Logger.AddProvider(TProviderConsole.Create);\n\n  // Definindo o template\n  Logger.SetTemplate('${timestamp} [${level}] ${message}');\n\n  // Gerando os logs\n  Logger.Info('My message with level INFO');\n  Logger.SlineBreak;\n  Logger.Error('My message with level ERROR');\n\n  // Output: 2022-12-01 09:00:05.500 [INFO] My message with level INFO\n  // Output:\n  // Output: 2022-12-01 09:00:05.600 [ERROR] My message with level ERROR\n\n  Readln;\nend.\n```\n\n### UndoLast\n\nThe function `UndoLast` using to undo the last record made.\n\n*   Some *Providers* do not have some feature that allows you to undo the last record sent.\n\n```delphi\nuses\n  DataLogger,\n  DataLogger.Provider.Console;\n\nbegin\n  Logger.AddProvider(TProviderConsole.Create);\n\n  // Definindo o template\n  Logger.SetTemplate('${timestamp} [${level}] ${message}');\n\n  // Gerando os logs\n  Logger.Info('My message with level INFO');\n\n  // Output: 2022-12-01 09:00:05.500 [INFO] My message with level INFO\n\n  Sleep(4000);\n  Logger.UndoLast;\n  Logger.Error('My message with level ERROR');\n\n  // Output: 2022-12-01 09:00:05.600 [ERROR] My message with level ERROR\n\n  Readln;\nend.\n```\n\n## Template (Log Format)\n\nThe template is the format in which the log will be generated.\n\ndefault template:\n\n```delphi\n${timestamp} [TID ${thread_id}] [PID ${process_id}] [SEQ ${sequence}] [${level}] [${tag}] ${message}\n```\n\n### Constants\n\nThere are some constants that can be used to facilitate the creation of the template.\n\n*   Common\n\n```delphi\n// Exibe o id que foi gerado o log, no formato GUID\nTLoggerTemplate.LOG_ID = '${id}';\n\n// Exibe o nome do log. ex: Logger.SetName('SERVICE_REMOTE')\nTLoggerTemplate.LOG_NAME = '${name}';\n\n// Exibe a sequencia que o log foi gerado.\nTLoggerTemplate.LOG_SEQUENCE = '${sequence}';\n\n// Exibe a data e hora que foi gerado, usado o SetFormatTimestamp\nTLoggerTemplate.LOG_TIMESTAMP = '${timestamp}';\n\n// Exibe a data e hora que foi gerado, no formato ISO8601.\nTLoggerTemplate.LOG_TIMESTAMP_ISO8601 = '${timestamp_iso8601}';\n\n// Exibe a data e hora que foi gerado, no formato UNIX.\nTLoggerTemplate.LOG_TIMESTAMP_UNIX = '${timestamp_unix}';\n\n// Exibe o Id da thread que foi gerado o log.\nTLoggerTemplate.LOG_THREADID = '${thread_id}';\n\n// Exibe o id do processo do app.\nTLoggerTemplate.LOG_PROCESSID = '${process_id}';\n\n// Exibe o level do log, sendo eles: TRACE / DEBUG / INFO / SUCCESS / WARN / ERROR / FATAL\nTLoggerTemplate.LOG_LEVEL = '${level}';\n\n// Exibe o level do log no formato numérico, sendo eles: 1=TRACE / 2=DEBUG / 3=INFO / 4=SUCCESS / 5=WARN / 6=ERROR / 7=FATAL / 8=CUSTOM\nTLoggerTemplate.LOG_LEVEL_VALUE = '${level_value}';\n\n// Exibe a tag do log, essa informação é preenchida a após a mensagem; Ex: Logger.Debug('Minha mensagem','Minha Tag');\nTLoggerTemplate.LOG_TAG = '${tag}';\n\n// Exibe a mensagem do log, sem essa tag a mensagem não é exibida. Ex: Logger.Debug('Minha mensagem');\nTLoggerTemplate.LOG_MESSAGE = '${message}';\n```\n\n*   Specials:\n\n```delphi\n// Exibe o nome do app.\nTLoggerTemplate.LOG_APPNAME = '${app_name}';\n\n// Exibe o diretório do app.\nTLoggerTemplate.LOG_APPPATH = '${app_path}';\n\n// Exibe a versão do app.\nTLoggerTemplate.LOG_APPVERSION = '${app_version}';\n\n// Exibe o tamanho do app em MB.\nTLoggerTemplate.LOG_APPSIZE = '${app_size}';\n\n// Exibe o nome do computador.\nTLoggerTemplate.LOG_COMPUTERNAME = '${computer_name}';\n\n// Exibe o nome do usuário do Sistema Operacional.\nTLoggerTemplate.LOG_USERNAME = '${username}';\n\n// Exibe as informações do Sistema Operacional.\nTLoggerTemplate.LOG_OSVERSION = '${os_version}';\n\n// Exibe o IP Local.\nTLoggerTemplate.LOG_IP_LOCAL = '${ip_local}';\n\n// Exibe o MAC Address.\nTLoggerTemplate.LOG_MAC_ADDRESS = '${mac_address}';\n\n```\n\n## SetTemplate\n\nDefines the format in which the log will be recorded\n\n```delphi\nuses\n  DataLogger,\n  DataLogger.Provider.Console;\n\nbegin\n  Logger.AddProvider(TProviderConsole.Create);\n\n  // Definindo o template\n  Logger.SetTemplate('${timestamp} [${level}] ${message}');\n\n  // Definindo o template com constante\n  Logger.SetTemplate(Format('%s [%s] %s', [TLoggerTemplate.LOG_TIMESTAMP, TLoggerTemplate.LOG_LEVEL, LoggerTemplate.LOG_MESSAGE]));\n\n  // Gerando os logs\n  Logger.Info('My message with level INFO');\n  Logger.Error('My message with level ERROR');\n\n  // Output: 2022-12-01 09:00:05.500 [INFO] My message with level INFO\n  // Output: 2022-12-01 09:00:05.600 [ERROR] My message with level ERROR\n\n  Readln;\nend.\n```\n\n### How to define a template in *providers* specific\n\n*   It is possible to define several specific settings in each *provider* separate.\n\n```delphi\nuses\n  DataLogger,\n  DataLogger.Provider.Console,\n  DataLogger.Provider.TextFile;\n\nbegin\n  // Formato do console '${timestamp} [${level}] ${message}'\n  Logger.AddProvider(\n    TProviderConsole.Create\n    .SetTemplate('${timestamp} [${level}] ${message}')\n  );\n\n  // Formato do text file '${timestamp} - ${message}'\n  Logger.AddProvider(\n    TProviderTextFile.Create\n    .SetTemplate('${timestamp} - ${message}')\n  );\n\n  // Gerando os logs\n  Logger.Info('My message with level INFO');\n  Logger.Error('My message with level ERROR');\n\n  // Output Console:\n  // 2022-12-01 09:00:05.500 [INFO] My message with level INFO\n  // 2022-12-01 09:00:05.600 [ERROR] My message with level ERROR\n\n  // Output TextFile:\n  // 2022-12-01 09:00:05.500 - My message with level INFO\n  // 2022-12-01 09:00:05.600 - My message with level ERROR\n\n  Readln;\nend.\n```\n\n## SetFormatTimestamp\n\nChanges the format of the TimeStamp.\n\n*   Default TimeStamp format: `yyyy-mm-dd hh:mm:ss.zzz`\n\n```delphi\nuses\n  DataLogger,\n  DataLogger.Provider.Console;\n\nbegin\n  Logger.AddProvider(TProviderConsole.Create);\n\n  // Definindo o formato do Timestamp\n  Logger.SetFormatTimestamp('dd/mm/yyyy hh:mm:ss')\n\n  // Definindo o template\n  Logger.SetTemplate('${timestamp} [${level}] ${message}');\n\n  // Definindo o template com constante\n  Logger.SetTemplate(Format('%s [%s] %s', [TLoggerTemplate.LOG_TIMESTAMP, TLoggerTemplate.LOG_LEVEL, LoggerTemplate.LOG_MESSAGE]));\n\n  // Gerando os logs\n  Logger.Info('My message with level INFO');\n  Logger.Error('My message with level ERROR');\n\n  // Output: 01/12/2022 09:00:05 [INFO] My message with level INFO\n  // Output: 01/12/2022 09:00:05 [ERROR] My message with level ERROR\n\n  Readln;\nend.\n```\n\n## Level\n\nThe DataLogger has these levels to generate the *logs*:\n\n```delphi\n  Logger.Trace('');\n  Logger.Debug('');\n  Logger.Info('');\n  Logger.Success('');\n  Logger.Warn('');\n  Logger.Error('');\n  Logger.Fatal('');\n  Logger.Custom('');\n\n  // Modo simplificado\n  Logger.T(''); // TRACE\n  Logger.D(''); // DEBUG\n  Logger.I(''); // INFO\n  Logger.S(''); // SUCCESS\n  Logger.W(''); // WARN\n  Logger.E(''); // ERROR\n  Logger.F(''); // FATAL\n  Logger.C(''); // CUSTOM\n```\n\n## SetLevelName\n\nIt is possible to change the level description to another description.\n\n```delphi\nuses\n  DataLogger,\n  DataLogger.Provider.Console;\n\nbegin\n  Logger.AddProvider(TProviderConsole.Create);\n\n  // Definindo o template\n  Logger.SetTemplate('${timestamp} [${level}] ${message}');\n\n  // Definindo o Level\n  Logger.SetLevelName(TLoggerLevel.Info, 'INFORMATION');\n  Logger.SetLevelName(TLoggerLevel.Warn, '  WARNING  ');\n\n  // Gerando os logs\n  Logger.Info('My message with level INFO');\n  Logger.Warn('My message with level WARN');\n\n  // Output: 2022-12-01 09:00:05.600 [INFORMATION] My message with level INFO\n  // Output: 2022-12-01 09:00:05.600 [  WARNING  ] My message with level WARN\n\n  Readln;\nend.\n```\n\n## SetLevel\n\nIt is possible to show only the *logs* from a *level* defined, based on `TLoggerLevel`.\n\nSetLevel default value = `TLoggerLevel.All`\n\n### TLoggerLevel\n\n*   When defining a level, only the chosen option and its superior types will be displayed.\n*   Ex: `Logger.SetLevel(TLoggerLevel.Warn);` - Will be registered only the *logs* with the type `Warn / Error / Fatal / Custom`.\n\n```delphi\n  TLoggerLevel.All = 'Utilizado para operações internas'\n  TLoggerLevel.Trace = 'Level 1'\n  TLoggerLevel.Debug = 'Level 2'\n  TLoggerLevel.Info = 'Level 3'\n  TLoggerLevel.Success = 'Level 4'\n  TLoggerLevel.Warn = 'Level 5'\n  TLoggerLevel.Error = 'Level 6'\n  TLoggerLevel.Fatal = 'Level 7'\n  TLoggerLevel.Custom = 'Level 8'\n```\n\n```delphi\nuses\n  DataLogger,\n  DataLogger.Provider.Console;\n\nbegin\n  Logger.AddProvider(TProviderConsole.Create);\n\n  // Definindo o template\n  Logger.SetTemplate('${timestamp} [${level}] ${message}');\n\n  // Definindo o Level\n  Logger.SetLevel(TLoggerLevel.Warn);\n\n  // Gerando os logs\n  Logger.Info('My message with level INFO');\n  Logger.Error('My message with level ERROR');\n\n  // Output: 2022-12-01 09:00:05.600 [ERROR] My message with level ERROR\n\n  Readln;\nend.\n```\n\n## SetDisableLevel\n\nIt is possible to disable some *levels* do log, com base no `TLoggerLevel`.\n\nSet Disable Level default value = `[]`\n\n*   When disabled, only options that are not disabled will be displayed.\n*   Ex: `Logger.SetDisableLevel([TLoggerLevel.Info, TLoggerLevel.Warn]);` - Will be registered only the *logs* with the type `Tracer / Debug / Success / Error / Fatal / Custom`.\n\n```delphi\nuses\n  DataLogger,\n  DataLogger.Provider.Console;\n\nbegin\n  Logger.AddProvider(TProviderConsole.Create);\n\n  // Definindo o template\n  Logger.SetTemplate('${timestamp} [${level}] ${message}');\n\n  // Definindo o DisableLevel\n  Logger.SetDisableLevel([TLoggerLevel.Info, TLoggerLevel.Warn]);\n\n  // Gerando os logs\n  Logger.Debug('My message with level DEBUG');\n  Logger.Info('My message with level INFO');\n  Logger.Warn('My message with level WARN');\n  Logger.Error('My message with level ERROR');\n\n  // Output:\n  // 2022-12-01 09:00:05.500 [DEBUG] My message with level DEBUG\n  // 2022-12-01 09:00:05.600 [ERROR] My message with level ERROR\n\n  Readln;\nend.\n```\n\n## SetOnlyLevel\n\nIt is possible to show only some *levels* do log, com base no `TLoggerLevel`.\n\nSetOnlyLevel default value = `[TLoggerLevel.All]`\n\n*   When defined, only registered options will be displayed.\n*   Ex: `Logger.SetOnlyLevel([TLoggerLevel.Error]);` - Will be registered only the *logs* with the type `Error`.\n\n```delphi\nuses\n  DataLogger,\n  DataLogger.Provider.Console;\n\nbegin\n  Logger.AddProvider(TProviderConsole.Create);\n\n  // Definindo o template\n  Logger.SetTemplate('${timestamp} [${level}] ${message}');\n\n  // Definindo o OnlyLevel\n  Logger.SetOnlyLevel([TLoggerLevel.Error]);\n\n  // Gerando os logs\n  Logger.Debug('My message with level DEBUG');\n  Logger.Info('My message with level INFO');\n  Logger.Warn('My message with level WARN');\n  Logger.Error('My message with level ERROR');\n\n  // Output:\n  // 2022-12-01 09:00:05.600 [ERROR] My message with level ERROR\n\n  Readln;\nend.\n```\n\n## SetLogException\n\nIt is possible to catch exceptions generated by *providers*\n\nSetLogException default value = `nil`\n\n```delphi\nuses\n  DataLogger,\n  DataLogger.Provider.Console;\n\nbegin\n  Logger.AddProvider(TProviderConsole.Create);\n\n  // Definindo o template\n  Logger.SetTemplate('${timestamp} [${level}] ${message}');\n\n  // Definindo o LogException\n  Logger.SetLogException(\n    procedure(const Sender: TObject; const LogItem: TLoggerItem; const E: Exception; var RetriesCount: Integer)\n    begin\n      // Sender - Provider que gerou a exceção, para visualizar - Sender.ClassName\n\n      // LogItem - Contém todas as informações do log\n\n      // E - Contém as informações da exceção\n\n      // RetriesCount - Contém o número da tentativa realizada\n      // Caso seja alterado o valor para -1, o processo é interrompido\n    end\n  );\n\n  // Gerando o log\n  Logger.Error('My message with level ERROR');\n\n  // Output:\n  // 2022-12-01 09:00:05.600 [ERROR] My message with level ERROR\n\n  Readln;\nend.\n```\n\n## SetMaxRetries\n\nIt is possible to set the number of attempts that the *Provider* should try when saving the log.\n\nSet Max Retries default value = `5`\n\n```delphi\nuses\n  DataLogger,\n  DataLogger.Provider.Console;\n\nbegin\n  Logger.AddProvider(TProviderConsole.Create);\n\n  // Definindo o template\n  Logger.SetTemplate('${timestamp} [${level}] ${message}');\n\n  // Definindo o máximo de tentativas\n  Logger.SetMaxRetries(5);\n\n  // Gerando o log\n  Logger.Error('My message with level ERROR');\n\n  // Output:\n  // 2022-12-01 09:00:05.600 [ERROR] My message with level ERROR\n\n  Readln;\nend.\n```\n\n## SetIgnoreTemplate\n\nIt is possible to ignore the Template and save all data generated by DataLogger;\n\n```delphi\n  SetIgnoreTemplate({1}, {2}, {3}, {4});\n\n  Parâmetros:\n    {1} = (Boolean) = Defini se deve ignorar o Template.\n    {2} = (string) = Defini qual texto vai fazer a separação das informações, semelhante ao CSV.\n    {3} = (Boolean) = Defini se deve mostrar as palavras chaves de cada valor.\n    {4} = (string) = Defini qual texto deve separar a palavra chave do valor.\n\n  Logger.SetIgnoreTemplate(True, '|', True, ' -\u003e ');\n\n  {palavra_chave}           = \"timestamp\"\n  {palavra_chave_separador} = \" -\u003e \"\n  {valor}                   = \"2022-09-15T14:39:38.896-03:00\"\n  {separator}               = \" | \"\n\n  // output timestamp -\u003e 2022-09-15T14:39:38.896-03:00 | timestamp_format -\u003e 2022-09-15 14:39:38.896\n```\n\n```delphi\nuses\n  DataLogger,\n  DataLogger.Provider.Console;\n\nbegin\n  Logger.AddProvider(TProviderConsole.Create);\n\n  // Definindo o template\n  Logger.SetTemplate('${timestamp} [${level}] ${message}');\n\n  // Ignorando o log format\n  Logger.SetIgnoreTemplate(True, '|', True, ' -\u003e ');\n\n  // Gerando o log\n  Logger.Error('My message with level ERROR');\n\n  // Output:\n  // timestamp -\u003e 2022-09-15T14:39:38.896-03:00 | timestamp_format -\u003e 2022-09-15 14:39:38.896 | name -\u003e | sequence -\u003e 1 | thread_id -\u003e 3804 | level -\u003e Trace | level_value -\u003e 1 | tag -\u003e | message -\u003e My Trace | app_name -\u003e ProviderTextFile | app_version -\u003e 1.0.0.0 | app_path -\u003e C:\\Github\\DataLogger\\Samples\\TextFile\\Win32\\Debug | app_size -\u003e 13,24 MB | computer_name -\u003e DESKTOP-7RP1H3K | username -\u003e danil | os_version -\u003e Windows 10 (Version 21H2, OS Build 19044.1889, 64-bit Edition) | process_id -\u003e 13608 | ip_local -\u003e 192.168.56.1\n\n  Readln;\nend.\n```\n\n## SetName\n\nIt is possible to define a name for the *DataLogger* which can be displayed in the log record. This name can be used to differentiate the *DataLogger* when more than one instance.\n\nSetName default value = `EmptyStr`\n\n```delphi\nuses\n  DataLogger,\n  DataLogger.Provider.Console;\n\nbegin\n  Logger.AddProvider(TProviderConsole.Create);\n\n  // Definindo o template\n  Logger.SetTemplate('${name} ${timestamp} [${level}] ${message}');\n\n  // Definindo o name\n  Logger.SetName('MyLogger');\n\n  // Gerando o log\n  Logger.Error('My message with level ERROR');\n\n  // Output:\n  // MyLogger 2022-12-01 09:00:05.600 [ERROR] My message with level ERROR\n\n  Readln;\nend.\n```\n\n## SetLiveMode\n\nIt is possible to save the logs in real time, so the next statement of your code will only continue after the log is saved!\n\nCurrently, the logs are recorded in memory and then saved without crashing the application.\n\nSetLiveMode default value = `false`\n\n```delphi\nuses\n  DataLogger,\n  DataLogger.Provider.Console;\n\nbegin\n  Logger.AddProvider(TProviderConsole.Create);\n\n  // Definindo o template\n  Logger.SetTemplate('${name} ${timestamp} [${level}] ${message}');\n\n  // Definindo o LiveMode\n  Logger.SetLiveMode(True);\n\n  // Gerando o log\n  Logger.Error('My message with level ERROR');\n\n  // Output:\n  // MyLogger 2022-12-01 09:00:05.600 [ERROR] My message with level ERROR\n\n  Readln;\nend.\n```\n\n## Transaction\n\nIs it possible to work with *Transaction*, just as it is used in other database-connected components.\n\nThe use of this procedure can be applied to the following situation;\n\nVamos contar uma pequena história:\n\n\u003e we have a *procedure* that is doing an execution, in each step several log information is generated, by habit we always save this information, this makes our text file, for example, too big. \u003cbr /\u003e Now imagine being able to save the data only if there was an error during execution or when it was really necessary to save the data.\n\n### how to enable\n\nEnabling the use of *Transaction* deve ser feita por *Provider* with the function `UseTransaction(True)`.\n\nEx:\n\n```delphi\nLogger.AddProvider(\n  TProviderConsole.Create\n  .UseTransaction(True) // Enable transaction only on this provider\n);\n```\n\n### StartTransaction\n\nStarts a new transaction.\n\n### CommitTransaction\n\nCommit the record of all logs in the transaction.\n\n### RollbackTransaction\n\nCancels all logs generated in the transaction.\n\n### Example with Simple Transaction\n\n[Sample com Transaction](https://github.com/dliocode/datalogger/tree/main/Samples/Transaction)\n\n```delphi\nuses\n  DataLogger,\n  DataLogger.Provider.Console;\n\nbegin\n  Logger.AddProvider(TProviderConsole.Create.UseTransaction(True));\n\n  // Definindo o template\n  Logger.SetTemplate('${timestamp} [${level}] ${message}');\n\n  // Iniciando a transaction\n  Logger.StartTransaction;\n\n  Writeln('Iniciou a transaction');\n\n  // Gerando o log\n  Logger.Info('My message with level INFO 1 ');\n  Logger.Info('My message with level INFO 2');\n  Logger.Info('My message with level INFO 3');\n  Logger.Info('My message with level INFO 4');\n  Logger.Info('My message with level INFO 5');\n  Logger.Info('My message with level INFO 6');\n  Logger.Info('My message with level INFO 7');\n  Logger.Info('My message with level INFO 8');\n  Logger.Info('My message with level INFO 9');\n\n  Writeln('Terminou os Logs');\n\n  // Fazendo o commit\n  Logger.CommitTransaction;\n  Writeln('Fez os commits');\n\n  Readln;\nend.\n```\n\n### example with *TRANSTO* nested\n\n[Sample with Nested Transaction](https://github.com/dliocode/datalogger/tree/main/Samples/Transaction%20Aninhada)\n\nAs *transactions* nested data gives the possibility of greater management when saving information.\n\n*   Only one observation must be remembered, the final record will only be saved if there was *commit* the parent transaction, that is, the transaction that started the whole process; \u003cbr /\u003e Caso a transação pai, tenha feito rollback, as transações filhas que foram feitas *commit* will be ignored!\n\n```delphi\nuses\n  DataLogger,\n  DataLogger.Provider.Console;\n\nbegin\n  Logger.AddProvider(TProviderConsole.Create.UseTransaction(True));\n\n  // Definindo o template\n  Logger.SetTemplate('${timestamp} [${level}] ${message}');\n\n  // Iniciando a transaction\n  Logger.StartTransaction;\n  try\n    // Gerando o log\n    Logger.Info('My message with level INFO 1 ');\n    Logger.Info('My message with level INFO 2');\n    Logger.Info('My message with level INFO 3');\n    Logger.Info('My message with level INFO 4');\n\n    // Iniciando 2 transaction\n    Logger.StartTransaction;\n    try\n      Logger.Info('My message with level INFO 5');\n      Logger.Info('My message with level INFO 6');\n    finally\n      // fazendo Rollback da segunda transaction\n      Logger.RollbackTransaction;\n    end;\n\n    Logger.Info('My message with level INFO 7');\n    Logger.Info('My message with level INFO 8');\n    Logger.Info('My message with level INFO 9');\n  finally\n    // Fazendo o commit\n    Logger.CommitTransaction;\n  end;\n\n  Readln;\nend.\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdliocode%2Fdatalogger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdliocode%2Fdatalogger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdliocode%2Fdatalogger/lists"}