-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Ajustes gerais * Novo provider - DiscordHook
- Loading branch information
Showing
28 changed files
with
1,361 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
program ProviderDiscordHook; | ||
|
||
uses | ||
Vcl.Forms, | ||
UProviderDiscordHook in 'UProviderDiscordHook.pas' {Form2}, | ||
DataLogger in '..\..\src\Core\DataLogger.pas', | ||
DataLogger.Provider in '..\..\src\Core\DataLogger.Provider.pas', | ||
DataLogger.Simple in '..\..\src\Core\DataLogger.Simple.pas', | ||
DataLogger.Types in '..\..\src\Core\DataLogger.Types.pas', | ||
DataLogger.Utils in '..\..\src\Core\DataLogger.Utils.pas', | ||
DataLogger.Provider.Discord.Hooks in '..\..\src\Providers\DataLogger.Provider.Discord.Hooks.pas', | ||
DataLogger.Provider.REST.HTTPClient in '..\..\src\Providers\DataLogger.Provider.REST.HTTPClient.pas', | ||
DataLogger.Provider.REST.Indy in '..\..\src\Providers\DataLogger.Provider.REST.Indy.pas', | ||
DataLogger.Provider.REST.NetHTTPClient in '..\..\src\Providers\DataLogger.Provider.REST.NetHTTPClient.pas'; | ||
|
||
{$R *.res} | ||
|
||
begin | ||
Application.Initialize; | ||
Application.MainFormOnTaskbar := True; | ||
Application.CreateForm(TForm2, Form2); | ||
Application.Run; | ||
end. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
object Form2: TForm2 | ||
Left = 0 | ||
Top = 0 | ||
Caption = 'DataLogger - Discord Hook' | ||
ClientHeight = 60 | ||
ClientWidth = 624 | ||
Color = clBtnFace | ||
Font.Charset = DEFAULT_CHARSET | ||
Font.Color = clWindowText | ||
Font.Height = -12 | ||
Font.Name = 'Segoe UI' | ||
Font.Style = [] | ||
OnCreate = FormCreate | ||
TextHeight = 15 | ||
object Panel1: TPanel | ||
Left = 0 | ||
Top = 21 | ||
Width = 624 | ||
Height = 41 | ||
Align = alTop | ||
TabOrder = 0 | ||
object btnMakeLog: TButton | ||
Left = 272 | ||
Top = 8 | ||
Width = 75 | ||
Height = 25 | ||
Caption = 'Make Log' | ||
TabOrder = 0 | ||
OnClick = btnMakeLogClick | ||
end | ||
end | ||
object pnlInfo: TPanel | ||
Left = 0 | ||
Top = 0 | ||
Width = 624 | ||
Height = 21 | ||
Cursor = crHandPoint | ||
Align = alTop | ||
Alignment = taLeftJustify | ||
BevelOuter = bvNone | ||
Caption = ' GITHUB: https://github.com/dliocode/datalogger' | ||
Color = clBlack | ||
Font.Charset = ANSI_CHARSET | ||
Font.Color = clWhite | ||
Font.Height = -11 | ||
Font.Name = 'Segoe UI' | ||
Font.Style = [fsBold] | ||
ParentBackground = False | ||
ParentFont = False | ||
TabOrder = 1 | ||
OnClick = pnlInfoClick | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
unit UProviderDiscordHook; | ||
|
||
interface | ||
|
||
uses | ||
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, | ||
Winapi.ShellAPI, | ||
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls; | ||
|
||
type | ||
TForm2 = class(TForm) | ||
Panel1: TPanel; | ||
btnMakeLog: TButton; | ||
pnlInfo: TPanel; | ||
procedure btnMakeLogClick(Sender: TObject); | ||
procedure FormCreate(Sender: TObject); | ||
procedure pnlInfoClick(Sender: TObject); | ||
private | ||
{ Private declarations } | ||
public | ||
{ Public declarations } | ||
end; | ||
|
||
var | ||
Form2: TForm2; | ||
|
||
implementation | ||
|
||
uses | ||
DataLogger, DataLogger.Provider.Discord.Hooks; | ||
|
||
{$R *.dfm} | ||
|
||
procedure TForm2.btnMakeLogClick(Sender: TObject); | ||
begin | ||
Logger | ||
.Trace('My trace') | ||
.Debug('My Debug') | ||
.Info('My Info') | ||
.Warn('My Warn') | ||
.Error('My Error') | ||
.Success('My Success') | ||
.Fatal('My Fatal'); | ||
end; | ||
|
||
procedure TForm2.FormCreate(Sender: TObject); | ||
begin | ||
ReportMemoryLeaksOnShutdown := True; | ||
|
||
Logger.AddProvider( | ||
TProviderDiscordHooks.Create | ||
.URL('https://discord.com/api/webhooks/<ID_CHANNEL>/<HASH>') // Add url webhook discord | ||
.Username('DataLogger') | ||
.AvatarURL('') | ||
); | ||
|
||
// Log Format | ||
Logger.SetLogFormat(TLoggerFormat.LOG_TIMESTAMP + ' - ' + TLoggerFOrmat.LOG_MESSAGE); | ||
end; | ||
|
||
procedure TForm2.pnlInfoClick(Sender: TObject); | ||
var | ||
LURL: string; | ||
begin | ||
LURL := pnlInfo.Caption; | ||
LURL := LURL.Replace('GITHUB: ', '').Replace(' ', ''); | ||
|
||
ShellExecute(0, 'open', PChar(LURL), nil, nil, SW_SHOWNORMAL); | ||
end; | ||
|
||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.