Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
N
nisanci
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Ali GOREN
nisanci
Commits
a4312db6
Kaydet (Commit)
a4312db6
authored
May 14, 2019
tarafından
Ali
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Removed js files under the lib dir
üst
89243ee8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2 additions
and
302 deletions
+2
-302
.gitignore
.gitignore
+2
-1
LogServer.js
lib/src/LogServer.js
+0
-70
LogTypes.js
lib/src/LogTypes.js
+0
-94
Logger.js
lib/src/Logger.js
+0
-137
No files found.
.gitignore
Dosyayı görüntüle @
a4312db6
lib/
lib/*
lib/src/*
tests/*.js
...
...
lib/src/LogServer.js
deleted
100644 → 0
Dosyayı görüntüle @
89243ee8
"use strict"
;
var
__assign
=
(
this
&&
this
.
__assign
)
||
function
()
{
__assign
=
Object
.
assign
||
function
(
t
)
{
for
(
var
s
,
i
=
1
,
n
=
arguments
.
length
;
i
<
n
;
i
++
)
{
s
=
arguments
[
i
];
for
(
var
p
in
s
)
if
(
Object
.
prototype
.
hasOwnProperty
.
call
(
s
,
p
))
t
[
p
]
=
s
[
p
];
}
return
t
;
};
return
__assign
.
apply
(
this
,
arguments
);
};
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
ServerException_1
=
require
(
"./Exceptions/ServerException"
);
/**
* @class LogServer
* @description This class helps to debug messages send to the server.
*/
var
LogServer
=
/** @class */
(
function
()
{
/**
*
* @param serverSettings Log backend settings as a parameter
*/
function
LogServer
(
serverSettings
)
{
/**
* Log Backend Settings
*/
this
.
settings
=
{
useServer
:
false
,
endPoint
:
''
,
method
:
'POST'
,
headers
:
{},
body
:
{}
};
this
.
settings
=
__assign
({},
serverSettings
);
if
(
this
.
settings
.
useServer
)
{
if
(
!
this
.
settings
.
endPoint
)
{
throw
new
ServerException_1
.
default
(
"Endpoint must be defined!"
);
}
}
}
/**
* @description private function to send data to log backend
* @function sendToServer
* @param sendBody
*/
LogServer
.
prototype
.
sendToServer
=
function
(
sendBody
)
{
var
endPoint
=
this
.
settings
.
endPoint
;
var
headers
=
this
.
settings
.
headers
;
var
body
=
this
.
settings
.
body
;
var
method
=
this
.
settings
.
method
;
return
fetch
(
endPoint
,
{
method
:
method
,
headers
:
__assign
({},
headers
),
body
:
JSON
.
stringify
(
__assign
({},
body
,
sendBody
))
});
};
/**
* @description public function to send data to log backend. If useServer flag is not true, data will not send to the server.
* @function sendToLogServer
* @param sendBody
*/
LogServer
.
prototype
.
sendToLogServer
=
function
(
sendBody
)
{
if
(
this
.
settings
.
useServer
)
{
this
.
sendToServer
(
sendBody
);
}
};
return
LogServer
;
}());
exports
.
default
=
LogServer
;
lib/src/LogTypes.js
deleted
100644 → 0
Dosyayı görüntüle @
89243ee8
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
/**
* @description Log Levels are explained by RFC 5424
* @see https://tools.ietf.org/html/rfc5424
* @enum LogTypes
*/
var
LogTypes
;
(
function
(
LogTypes
)
{
/**
* @description System is unusable
* @type {integer}
*/
LogTypes
[
LogTypes
[
"EMERGENCY"
]
=
600
]
=
"EMERGENCY"
;
/**
* @description Action must be taken immediately.
* * Example: Server returned 500, browser doesn't support function etc. This should trigger backend alerts.
* @type {integer}
*/
LogTypes
[
LogTypes
[
"ALERT"
]
=
550
]
=
"ALERT"
;
/**
* @description Critical conditions
* * Example: Components unavailable or unexpected exceptions
* @type {integer}
*/
LogTypes
[
LogTypes
[
"CRITICAL"
]
=
500
]
=
"CRITICAL"
;
/**
* @description Error conditions
* * Example: Runtime errors, for example when parseInt or toFixed errors work wrong
* @type {integer}
*/
LogTypes
[
LogTypes
[
"ERROR"
]
=
400
]
=
"ERROR"
;
/**
* @description Warning conditions
* * Example: You can use to show deprecated messages, old API or functions
* @type {integer}
*/
LogTypes
[
LogTypes
[
"WARNING"
]
=
300
]
=
"WARNING"
;
/**
* @description Normal but significant condition
* * Example: Normal but significant events
* @type {integer}
*/
LogTypes
[
LogTypes
[
"NOTICE"
]
=
250
]
=
"NOTICE"
;
/**
* @description Informational messages
* * Example: Interesting behavioral events. For example, event firing, dom changing etc.
* @type {integer}
*/
LogTypes
[
LogTypes
[
"INFO"
]
=
200
]
=
"INFO"
;
/**
* @description Debug-level messages
* * Example: Detailed debug information
* @type {integer}
*/
LogTypes
[
LogTypes
[
"DEBUG"
]
=
100
]
=
"DEBUG"
;
})(
LogTypes
||
(
LogTypes
=
{}));
var
Levels
=
/** @class */
(
function
()
{
function
Levels
()
{
}
Levels
.
GET
=
function
(
logType
)
{
switch
(
logType
)
{
case
100
:
return
"DEBUG"
;
break
;
case
200
:
return
"INFO"
;
break
;
case
250
:
return
"NOTICE"
;
break
;
case
300
:
return
"WARNING"
;
break
;
case
400
:
return
"ERROR"
;
break
;
case
500
:
return
"CRITICAL"
;
break
;
case
550
:
return
"ALERT"
;
break
;
case
600
:
return
"EMERGENCY"
;
break
;
default
:
break
;
}
};
return
Levels
;
}());
exports
.
Levels
=
Levels
;
exports
.
default
=
LogTypes
;
lib/src/Logger.js
deleted
100644 → 0
Dosyayı görüntüle @
89243ee8
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
var
LogTypes_1
=
require
(
"./LogTypes"
);
var
LogServer_1
=
require
(
"./LogServer"
);
/**
* @description Logger class. This class will have logging functions
* @class Logger
*/
var
Logger
=
/** @class */
(
function
()
{
function
Logger
(
logConfig
)
{
this
.
config
=
{
useServer
:
false
,
endPoint
:
''
,
method
:
'POST'
,
headers
:
{},
body
:
{}
};
this
.
config
=
logConfig
;
this
.
server
=
new
LogServer_1
.
default
(
this
.
config
.
server
);
}
/**
* @description Send extra fields to the log backend
* @function send
* @param sendBody Extra body field
* @example
* loggerInstance.send({ pageUrl: 'test', 'time': '12:30' })
*/
Logger
.
prototype
.
send
=
function
(
sendBody
)
{
return
this
.
server
.
sendToLogServer
(
sendBody
);
};
/**
* @description Debug Level Message
* @function debug
* @param message any type of message
* @param context Context will use to handle params. For example user IP address, username etc.
* @example
* loggerInstance.debug('Debug User', { username: 'John' })
*/
Logger
.
prototype
.
debug
=
function
(
message
,
context
)
{
var
logCode
=
LogTypes_1
.
default
.
DEBUG
;
var
levelName
=
LogTypes_1
.
Levels
.
GET
(
logCode
);
console
.
log
(
logCode
,
levelName
);
};
/**
* @description Informational messages
* @function info
* @param message any type of message
* @param context Context will use to handle params. For example user IP address, username etc.
* @example
* loggerInstance.info('Info User', { username: 'John' })
*/
Logger
.
prototype
.
info
=
function
(
message
,
context
)
{
var
logCode
=
LogTypes_1
.
default
.
INFO
;
var
levelName
=
LogTypes_1
.
Levels
.
GET
(
logCode
);
console
.
log
(
logCode
,
levelName
);
};
/**
* @description Normal but significant condition
* @function notice
* @param message any type of message
* @param context Context will use to handle params. For example user IP address, username etc.
* @example
* loggerInstance.notice('Notice User', { username: 'John' })
*/
Logger
.
prototype
.
notice
=
function
(
message
,
context
)
{
var
logCode
=
LogTypes_1
.
default
.
NOTICE
;
var
levelName
=
LogTypes_1
.
Levels
.
GET
(
logCode
);
console
.
log
(
logCode
,
levelName
);
};
/**
* @description You can use to show deprecated messages, old API or functions
* @function warning
* @param message any type of message
* @param context Context will use to handle params. For example user IP address, username etc.
* @example
* loggerInstance.warning('Warning User', { username: 'John' })
*/
Logger
.
prototype
.
warning
=
function
(
message
,
context
)
{
var
logCode
=
LogTypes_1
.
default
.
WARNING
;
var
levelName
=
LogTypes_1
.
Levels
.
GET
(
logCode
);
console
.
log
(
logCode
,
levelName
);
};
/**
* @description Runtime errors, for example when parseInt or toFixed errors work wrong
* @function error
* @param message any type of message
* @param context Context will use to handle params. For example user IP address, username etc.
* @example
* loggerInstance.error('Error User', { username: 'John' })
*/
Logger
.
prototype
.
error
=
function
(
message
,
context
)
{
var
logCode
=
LogTypes_1
.
default
.
ERROR
;
var
levelName
=
LogTypes_1
.
Levels
.
GET
(
logCode
);
console
.
log
(
logCode
,
levelName
);
};
/**
* @description Components unavailable or unexpected exceptions
* @function critical
* @param message any type of message
* @param context Context will use to handle params. For example user IP address, username etc.
* @example
* loggerInstance.critical('Critical message User', { username: 'John' })
*/
Logger
.
prototype
.
critical
=
function
(
message
,
context
)
{
var
logCode
=
LogTypes_1
.
default
.
CRITICAL
;
var
levelName
=
LogTypes_1
.
Levels
.
GET
(
logCode
);
console
.
log
(
logCode
,
levelName
);
};
/**
* @description Action must be taken immediately.
* @function alert
* @param message any type of message
* @param context Context will use to handle params. For example user IP address, username etc.
* @example
* loggerInstance.alert('Alert message User', { username: 'John' })
*/
Logger
.
prototype
.
alert
=
function
(
message
,
context
)
{
var
logCode
=
LogTypes_1
.
default
.
ALERT
;
var
levelName
=
LogTypes_1
.
Levels
.
GET
(
logCode
);
console
.
log
(
logCode
,
levelName
);
};
/**
* @description System is unusable
* @function emergency
* @param message any type of message
* @param context Context will use to handle params. For example user IP address, username etc.
* @example
* loggerInstance.emergency('Emergency message User', { username: 'John' })
*/
Logger
.
prototype
.
emergency
=
function
(
message
,
context
)
{
var
logCode
=
LogTypes_1
.
default
.
EMERGENCY
;
var
levelName
=
LogTypes_1
.
Levels
.
GET
(
logCode
);
console
.
log
(
logCode
,
levelName
);
};
return
Logger
;
}());
exports
.
default
=
Logger
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment