LogEvent (rtl)
De Wiki1000
(Différences entre les versions)
(Page créée avec « <source lang='delphi'>function logEvent(const iCategory,iAction,iLabel:string; iValue:Integer; iMetric:Integer):boolean;</source> Cette fonction permet d'émettre un év... ») |
m |
||
| (16 révisions intermédiaires par un utilisateur sont masquées) | |||
| Ligne 1 : | Ligne 1 : | ||
| − | <source lang='delphi'>function logEvent(const iCategory, | + | {{Version700}} |
| + | <source lang='delphi'>function logEvent(const iCategory,iModuleName,iAction:string; const iKeys:Array of variant; const iValues:Array of variant; iDuration:Double):boolean;</source> | ||
Cette fonction permet d'émettre un évènement vers l'enregistreur de log. | Cette fonction permet d'émettre un évènement vers l'enregistreur de log. | ||
| Ligne 10 : | Ligne 11 : | ||
|iCategory | |iCategory | ||
|Catégorie de l'évènement. | |Catégorie de l'évènement. | ||
| + | |- | ||
| + | |iModuleName | ||
| + | |Module de l'évènement. | ||
|- | |- | ||
|iAction | |iAction | ||
|Action associé à l'évènement. | |Action associé à l'évènement. | ||
|- | |- | ||
| − | | | + | |iKeys |
| − | | | + | |Tableau de clé |
|- | |- | ||
| − | | | + | |iValues |
| − | | | + | |Tableau de valeur |
|- | |- | ||
| − | | | + | |iDuration |
| − | | | + | |Information de durée liée à l'évènement |
|} | |} | ||
| − | Exemple | + | Cet évènement positionne les attributs suivants : |
| + | |||
| + | {|class="wikitable" | ||
| + | |- | ||
| + | !Nom de l'attribut | ||
| + | !Valeur de l'attribut | ||
| + | |- | ||
| + | |actionCategory | ||
| + | |iCategory | ||
| + | |- | ||
| + | |actionModule | ||
| + | |iModule | ||
| + | |- | ||
| + | |actionName | ||
| + | |iAction | ||
| + | |- | ||
| + | |actionLabel | ||
| + | |iKeys[0] | ||
| + | |- | ||
| + | |actionValue | ||
| + | |iValues[0] | ||
| + | |} | ||
| + | |||
| + | Ces attributs peuvent être utilisé dans les [[Gestion_des_évènements_(server)|handlers d'évènement]]. | ||
| + | |||
| + | |||
| + | Exemple : | ||
| + | |||
| + | Voici la déclaration du handler envoyant ce type d'évènement vers Google Analytics. | ||
| + | |||
| + | <pre> | ||
| + | [\SOFTWARE\Sage\Ligne 1000\Administration\LOGManager\GA_EVENT] | ||
| + | type = http | ||
| + | url = http://www.google-analytics.com/collect | ||
| + | method = POST | ||
| + | contentType = application/x-www-form-urlencoded | ||
| + | accept = application/text | ||
| + | keep-alive = 0 | ||
| + | categories = sysevent,confevent,taskevent,processevent,event | ||
| + | content = t=event&v=1&tid=[gaUA]&cid=[DeviceID]&cd1=[CustomerID]&cd2=[appName]-[appVersion]&cd3=[id]&cd4=[UserID]&cd5=[systemOSInfoEx]& \ | ||
| + | ec=[actionCategory]&ea=[actionName]&el=[actionLabel]&ev=[actionValue]&cm1=[actionValue1]&cd6=[actionModule] | ||
| + | </pre> | ||
| + | |||
<source lang='delphi'> | <source lang='delphi'> | ||
begin | begin | ||
| + | logEvent('process','TProcessusComptabilisation',['Nbr. pièce','Nbr. ecriture'],[100,1000]); | ||
end; | end; | ||
</source> | </source> | ||
| + | |||
| + | <source lang='delphi'> | ||
| + | //Procedure TestLogEvent; | ||
| + | var idx:Integer; keys:Array of string; values:Array of variant; tk1,tk2:longint; | ||
| + | begin | ||
| + | tk1 := GetTickCount; | ||
| + | for idx:=0 to 9 do | ||
| + | begin | ||
| + | Keys[idx] := 'event'+inttostr(idx); | ||
| + | Values[idx] := idx; | ||
| + | end; | ||
| + | tk2 := GetTickCount; | ||
| + | logEvent('process','GCF-Echeance',ClassName,Keys,Values,TicktoMS(tk2-tk1)); | ||
| + | end; | ||
| + | </source> | ||
| + | |||
| + | {{tip|Ne pas passer de tableau statique, un type tableau statique n'est pas compatible avec un type tableau ouvert}} | ||
Voir aussi: | Voir aussi: | ||
| + | * [[Tableaux_ouverts_(lang)|Tableaux ouverts]] | ||
| − | {{Footer| | + | {{Footer|Gestion_des_évènements_(server)}} |
[[category:Logger]] | [[category:Logger]] | ||
| − | [[category: | + | [[category:Logs]] |
Version actuelle en date du 20 novembre 2018 à 13:56
function logEvent(const iCategory,iModuleName,iAction:string; const iKeys:Array of variant; const iValues:Array of variant; iDuration:Double):boolean;
Cette fonction permet d'émettre un évènement vers l'enregistreur de log.
| Result | True : L'évènement a été transmis |
| iCategory | Catégorie de l'évènement. |
| iModuleName | Module de l'évènement. |
| iAction | Action associé à l'évènement. |
| iKeys | Tableau de clé |
| iValues | Tableau de valeur |
| iDuration | Information de durée liée à l'évènement |
Cet évènement positionne les attributs suivants :
| Nom de l'attribut | Valeur de l'attribut |
|---|---|
| actionCategory | iCategory |
| actionModule | iModule |
| actionName | iAction |
| actionLabel | iKeys[0] |
| actionValue | iValues[0] |
Ces attributs peuvent être utilisé dans les handlers d'évènement.
Exemple :
Voici la déclaration du handler envoyant ce type d'évènement vers Google Analytics.
[\SOFTWARE\Sage\Ligne 1000\Administration\LOGManager\GA_EVENT]
type = http
url = http://www.google-analytics.com/collect
method = POST
contentType = application/x-www-form-urlencoded
accept = application/text
keep-alive = 0
categories = sysevent,confevent,taskevent,processevent,event
content = t=event&v=1&tid=[gaUA]&cid=[DeviceID]&cd1=[CustomerID]&cd2=[appName]-[appVersion]&cd3=[id]&cd4=[UserID]&cd5=[systemOSInfoEx]& \
ec=[actionCategory]&ea=[actionName]&el=[actionLabel]&ev=[actionValue]&cm1=[actionValue1]&cd6=[actionModule]
begin logEvent('process','TProcessusComptabilisation',['Nbr. pièce','Nbr. ecriture'],[100,1000]); end;
//Procedure TestLogEvent; var idx:Integer; keys:Array of string; values:Array of variant; tk1,tk2:longint; begin tk1 := GetTickCount; for idx:=0 to 9 do begin Keys[idx] := 'event'+inttostr(idx); Values[idx] := idx; end; tk2 := GetTickCount; logEvent('process','GCF-Echeance',ClassName,Keys,Values,TicktoMS(tk2-tk1)); end;
| Tip : Ne pas passer de tableau statique, un type tableau statique n'est pas compatible avec un type tableau ouvert |
Voir aussi:
| Whos here now: Members 0 Guests 0 Bots & Crawlers 1 |