Logging Web Interface
**Work in progress** + Added an error message to the template package
This commit is contained in:
parent
0c24bd749a
commit
7a4f8acff1
@ -1153,7 +1153,7 @@ textarea.w-select {
|
|||||||
* Safari (on both iOS and OS X) does not handle viewport units (vh, vw) well.
|
* Safari (on both iOS and OS X) does not handle viewport units (vh, vw) well.
|
||||||
* For example percentage units do not work on descendants of elements that
|
* For example percentage units do not work on descendants of elements that
|
||||||
* have any dimensions expressed in viewport units. It also doesn’t handle them at
|
* have any dimensions expressed in viewport units. It also doesn’t handle them at
|
||||||
* all in `calc()`.
|
* all in calc().
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Wrapper around all lightbox elements
|
* Wrapper around all lightbox elements
|
||||||
@ -1319,7 +1319,7 @@ textarea.w-select {
|
|||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* 1. We use content-box to avoid having to do `width: calc(10vh + 2vw)`
|
* 1. We use content-box to avoid having to do "width: calc(10vh + 2vw)"
|
||||||
* which doesn’t work in Safari anyway.
|
* which doesn’t work in Safari anyway.
|
||||||
* 2. Chrome renders images pixelated when switching to GPU. Making sure
|
* 2. Chrome renders images pixelated when switching to GPU. Making sure
|
||||||
* the parent is also rendered on the GPU (by setting translate3d for
|
* the parent is also rendered on the GPU (by setting translate3d for
|
||||||
|
@ -291,9 +291,9 @@ Webflow.init = function() {
|
|||||||
// Collection Functions
|
// Collection Functions
|
||||||
// --------------------
|
// --------------------
|
||||||
|
|
||||||
// The cornerstone, an `each` implementation, aka `forEach`.
|
// The cornerstone, an "each" implementation, aka "forEach".
|
||||||
// Handles objects with the built-in `forEach`, arrays, and raw objects.
|
// Handles objects with the built-in "forEach", arrays, and raw objects.
|
||||||
// Delegates to **ECMAScript 5**'s native `forEach` if available.
|
// Delegates to **ECMAScript 5**'s native "forEach" if available.
|
||||||
var each = _.each = _.forEach = function(obj, iterator, context) {
|
var each = _.each = _.forEach = function(obj, iterator, context) {
|
||||||
/* jshint shadow:true */
|
/* jshint shadow:true */
|
||||||
if (obj == null) return obj;
|
if (obj == null) return obj;
|
||||||
@ -313,7 +313,7 @@ Webflow.init = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Return the results of applying the iterator to each element.
|
// Return the results of applying the iterator to each element.
|
||||||
// Delegates to **ECMAScript 5**'s native `map` if available.
|
// Delegates to **ECMAScript 5**'s native "map" if available.
|
||||||
_.map = _.collect = function(obj, iterator, context) {
|
_.map = _.collect = function(obj, iterator, context) {
|
||||||
var results = [];
|
var results = [];
|
||||||
if (obj == null) return results;
|
if (obj == null) return results;
|
||||||
@ -324,7 +324,7 @@ Webflow.init = function() {
|
|||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Return the first value which passes a truth test. Aliased as `detect`.
|
// Return the first value which passes a truth test. Aliased as "detect".
|
||||||
_.find = _.detect = function(obj, predicate, context) {
|
_.find = _.detect = function(obj, predicate, context) {
|
||||||
var result;
|
var result;
|
||||||
any(obj, function(value, index, list) {
|
any(obj, function(value, index, list) {
|
||||||
@ -337,8 +337,8 @@ Webflow.init = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Return all the elements that pass a truth test.
|
// Return all the elements that pass a truth test.
|
||||||
// Delegates to **ECMAScript 5**'s native `filter` if available.
|
// Delegates to **ECMAScript 5**'s native "filter" if available.
|
||||||
// Aliased as `select`.
|
// Aliased as "select".
|
||||||
_.filter = _.select = function(obj, predicate, context) {
|
_.filter = _.select = function(obj, predicate, context) {
|
||||||
var results = [];
|
var results = [];
|
||||||
if (obj == null) return results;
|
if (obj == null) return results;
|
||||||
@ -350,8 +350,8 @@ Webflow.init = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Determine if at least one element in the object matches a truth test.
|
// Determine if at least one element in the object matches a truth test.
|
||||||
// Delegates to **ECMAScript 5**'s native `some` if available.
|
// Delegates to **ECMAScript 5**'s native "some" if available.
|
||||||
// Aliased as `any`.
|
// Aliased as "any".
|
||||||
var any = _.some = _.any = function(obj, predicate, context) {
|
var any = _.some = _.any = function(obj, predicate, context) {
|
||||||
predicate || (predicate = _.identity);
|
predicate || (predicate = _.identity);
|
||||||
var result = false;
|
var result = false;
|
||||||
@ -363,8 +363,8 @@ Webflow.init = function() {
|
|||||||
return !!result;
|
return !!result;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Determine if the array or object contains a given value (using `===`).
|
// Determine if the array or object contains a given value (using "===").
|
||||||
// Aliased as `include`.
|
// Aliased as "include".
|
||||||
_.contains = _.include = function(obj, target) {
|
_.contains = _.include = function(obj, target) {
|
||||||
if (obj == null) return false;
|
if (obj == null) return false;
|
||||||
if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;
|
if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;
|
||||||
@ -407,7 +407,7 @@ Webflow.init = function() {
|
|||||||
|
|
||||||
// Returns a function, that, as long as it continues to be invoked, will not
|
// Returns a function, that, as long as it continues to be invoked, will not
|
||||||
// be triggered. The function will be called after it stops being called for
|
// be triggered. The function will be called after it stops being called for
|
||||||
// N milliseconds. If `immediate` is passed, trigger the function on the
|
// N milliseconds. If "immediate" is passed, trigger the function on the
|
||||||
// leading edge, instead of the trailing.
|
// leading edge, instead of the trailing.
|
||||||
_.debounce = function(func, wait, immediate) {
|
_.debounce = function(func, wait, immediate) {
|
||||||
var timeout, args, context, timestamp, result;
|
var timeout, args, context, timestamp, result;
|
||||||
@ -446,7 +446,7 @@ Webflow.init = function() {
|
|||||||
// ----------------
|
// ----------------
|
||||||
|
|
||||||
// Retrieve the names of an object's properties.
|
// Retrieve the names of an object's properties.
|
||||||
// Delegates to **ECMAScript 5**'s native `Object.keys`
|
// Delegates to **ECMAScript 5**'s native "Object.keys"
|
||||||
_.keys = function(obj) {
|
_.keys = function(obj) {
|
||||||
if (!_.isObject(obj)) return [];
|
if (!_.isObject(obj)) return [];
|
||||||
if (nativeKeys) return nativeKeys(obj);
|
if (nativeKeys) return nativeKeys(obj);
|
||||||
@ -2446,12 +2446,12 @@ var lightbox = (function (window, document, $, tram, undefined) {
|
|||||||
* Creates the DOM structure required by the lightbox.
|
* Creates the DOM structure required by the lightbox.
|
||||||
*/
|
*/
|
||||||
lightbox.build = function () {
|
lightbox.build = function () {
|
||||||
// In case `build` is called more than once.
|
// In case "build" is called more than once.
|
||||||
lightbox.destroy();
|
lightbox.destroy();
|
||||||
|
|
||||||
$refs = {
|
$refs = {
|
||||||
html: $(document.documentElement),
|
html: $(document.documentElement),
|
||||||
// Empty jQuery object can be used to build new ones using `.add`.
|
// Empty jQuery object can be used to build new ones using ".add".
|
||||||
empty: $()
|
empty: $()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2491,7 +2491,7 @@ var lightbox = (function (window, document, $, tram, undefined) {
|
|||||||
// IE loses focus to inner nodes without letting us know.
|
// IE loses focus to inner nodes without letting us know.
|
||||||
.on('focusin', focusThis);
|
.on('focusin', focusThis);
|
||||||
|
|
||||||
// The `tabindex` attribute is needed to enable non-input elements
|
// The "tabindex" attribute is needed to enable non-input elements
|
||||||
// to receive keyboard events.
|
// to receive keyboard events.
|
||||||
$('body').append($refs.lightbox.prop('tabIndex', 0));
|
$('body').append($refs.lightbox.prop('tabIndex', 0));
|
||||||
|
|
||||||
|
@ -2,8 +2,6 @@ package Web
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/SommerEngineering/Ocean/Log"
|
|
||||||
LM "github.com/SommerEngineering/Ocean/Log/Meta"
|
|
||||||
"github.com/SommerEngineering/Ocean/Log/Web/Assets"
|
"github.com/SommerEngineering/Ocean/Log/Web/Assets"
|
||||||
"github.com/SommerEngineering/Ocean/Shutdown"
|
"github.com/SommerEngineering/Ocean/Shutdown"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
30
Log/Web/HandlerLog.go
Normal file
30
Log/Web/HandlerLog.go
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package Web
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/SommerEngineering/Ocean/Log"
|
||||||
|
LM "github.com/SommerEngineering/Ocean/Log/Meta"
|
||||||
|
"github.com/SommerEngineering/Ocean/Log/Web/Scheme"
|
||||||
|
"github.com/SommerEngineering/Ocean/MimeTypes"
|
||||||
|
"github.com/SommerEngineering/Ocean/Shutdown"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
func HandlerWebLog(response http.ResponseWriter, request *http.Request) {
|
||||||
|
|
||||||
|
if Shutdown.IsDown() {
|
||||||
|
http.NotFound(response, request)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
data := Scheme.Viewer{}
|
||||||
|
data.Events = make([]Scheme.LogEvent, 3)
|
||||||
|
data.Events[0].AB = Scheme.A
|
||||||
|
data.Events[0].LogLevel = Scheme.LogINFO
|
||||||
|
data.Events[0].LogLine = `hello world`
|
||||||
|
data.Title = `Web Log Viewer`
|
||||||
|
|
||||||
|
MimeTypes.Write2HTTP(response, MimeTypes.TypeWebHTML)
|
||||||
|
if executeError := templates.ExecuteTemplate(response, `WebLog`, data); executeError != nil {
|
||||||
|
Log.LogFull(senderName, LM.CategorySYSTEM, LM.LevelERROR, LM.SeverityCritical, LM.ImpactCritical, LM.MessageNameEXECUTE, `Was not able to execute the web log viewer template.`, executeError.Error())
|
||||||
|
}
|
||||||
|
}
|
19
Log/Web/Init.go
Normal file
19
Log/Web/Init.go
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package Web
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/SommerEngineering/Ocean/Log"
|
||||||
|
LM "github.com/SommerEngineering/Ocean/Log/Meta"
|
||||||
|
WebTemp "github.com/SommerEngineering/Ocean/Log/Web/Templates"
|
||||||
|
"html/template"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
|
||||||
|
Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameINIT, `Init the web log.`)
|
||||||
|
defer Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameINIT, `Init the web log done.`)
|
||||||
|
|
||||||
|
templates = template.New(`root`)
|
||||||
|
if _, err := templates.Parse(WebTemp.Viewer); err != nil {
|
||||||
|
Log.LogFull(senderName, LM.CategorySYSTEM, LM.LevelERROR, LM.SeverityCritical, LM.ImpactUnknown, LM.MessageNamePARSE, `Was not able to parse the template for the web log viewer.`, err.Error())
|
||||||
|
}
|
||||||
|
}
|
12
Log/Web/Scheme/Constants.go
Normal file
12
Log/Web/Scheme/Constants.go
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package Scheme
|
||||||
|
|
||||||
|
const (
|
||||||
|
A string = `loga`
|
||||||
|
B string = `logb`
|
||||||
|
LogWARN = `logwarn`
|
||||||
|
LogDEBUG = `logdebug`
|
||||||
|
LogERROR = `logerror`
|
||||||
|
LogINFO = `loginfo`
|
||||||
|
LogTALKATIVE = `logtalkative`
|
||||||
|
LogSECURITY = `logsecurity`
|
||||||
|
)
|
@ -1,6 +1,7 @@
|
|||||||
package Templates
|
package Templates
|
||||||
|
|
||||||
var Viewer string = `
|
var Viewer string = `
|
||||||
|
{{define "WebLog"}}
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<!-- This site was created in Webflow. http://www.webflow.com-->
|
<!-- This site was created in Webflow. http://www.webflow.com-->
|
||||||
<!-- Last Published: Mon Feb 02 2015 20:11:43 GMT+0000 (UTC) -->
|
<!-- Last Published: Mon Feb 02 2015 20:11:43 GMT+0000 (UTC) -->
|
||||||
@ -122,4 +123,5 @@ var Viewer string = `
|
|||||||
<script type="text/javascript" src="/log/js/jquery.min.js"></script>
|
<script type="text/javascript" src="/log/js/jquery.min.js"></script>
|
||||||
<script type="text/javascript" src="/log/js/webflow.js"></script>
|
<script type="text/javascript" src="/log/js/webflow.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>`
|
</html>
|
||||||
|
{{end}}`
|
||||||
|
11
Log/Web/Variables.go
Normal file
11
Log/Web/Variables.go
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package Web
|
||||||
|
|
||||||
|
import (
|
||||||
|
LM "github.com/SommerEngineering/Ocean/Log/Meta"
|
||||||
|
"html/template"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
templates *template.Template = nil
|
||||||
|
senderName LM.Sender = `System::WebLog`
|
||||||
|
)
|
@ -32,7 +32,7 @@ func InitHandlers() {
|
|||||||
Handlers.AddAdminHandler(`/next/number`, NumGen.HandlerGetNext)
|
Handlers.AddAdminHandler(`/next/number`, NumGen.HandlerGetNext)
|
||||||
Handlers.AddAdminHandler(`/ICCC`, ICCC.ICCCHandler)
|
Handlers.AddAdminHandler(`/ICCC`, ICCC.ICCCHandler)
|
||||||
Handlers.AddAdminHandler(`/binaryAssets/`, BinaryAssets.HandlerBinaryAssets)
|
Handlers.AddAdminHandler(`/binaryAssets/`, BinaryAssets.HandlerBinaryAssets)
|
||||||
//Handlers.AddAdminHandler(`/log`)
|
Handlers.AddAdminHandler(`/log`, Web.HandlerWebLog)
|
||||||
Handlers.AddAdminHandler(`/log/css/normalize.css`, Web.HandlerCSSNormalize)
|
Handlers.AddAdminHandler(`/log/css/normalize.css`, Web.HandlerCSSNormalize)
|
||||||
Handlers.AddAdminHandler(`/log/css/webflow.css`, Web.HandlerCSSWebflow)
|
Handlers.AddAdminHandler(`/log/css/webflow.css`, Web.HandlerCSSWebflow)
|
||||||
Handlers.AddAdminHandler(`/log/css/log.css`, Web.HandlerCSSLog)
|
Handlers.AddAdminHandler(`/log/css/log.css`, Web.HandlerCSSLog)
|
||||||
|
@ -54,8 +54,11 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
templateData := string(contentData)
|
templateData := string(contentData)
|
||||||
templates.Parse(templateData)
|
if _, err := templates.Parse(templateData); err != nil {
|
||||||
|
Log.LogFull(senderName, LM.CategorySYSTEM, LM.LevelERROR, LM.SeverityMiddle, LM.ImpactMiddle, LM.MessageNamePARSE, fmt.Sprintf(`The template '%s' cannot be parsed.`, file.FileInfo().Name()), err.Error())
|
||||||
|
} else {
|
||||||
Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameEXECUTE, fmt.Sprintf(`The template '%s' was parsed.`, file.FileInfo().Name()))
|
Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameEXECUTE, fmt.Sprintf(`The template '%s' was parsed.`, file.FileInfo().Name()))
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.LogFull(senderName, LM.CategorySYSTEM, LM.LevelERROR, LM.SeverityCritical, LM.ImpactCritical, LM.MessageNameDATABASE, `Was not able to open a template.`, file.FileInfo().Name())
|
Log.LogFull(senderName, LM.CategorySYSTEM, LM.LevelERROR, LM.SeverityCritical, LM.ImpactCritical, LM.MessageNameDATABASE, `Was not able to open a template.`, file.FileInfo().Name())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user